Route email to tickets with SMTP
Start Liyagent's SMTP listener, send mail to it with swaks or Python, and watch messages become classified tickets.
After reading this page you will be able to:
- Start the built-in SMTP listener
- Send test mail and ingest it
- Turn on automatic ingestion
Beginner15 minIntegrationsDocker
Prerequisites
- A running Liyagent instance on your machine.
swaks, or Python 3.
Steps
- Start the listener from General settings → Dev mail server → Start, or:
curl -b cookies.txt -X POST http://127.0.0.1:8787/api/mailserver/start curl -b cookies.txt http://127.0.0.1:8787/api/mailserverIt listens on
127.0.0.1:2525by default. - Send a message.
swaks --server 127.0.0.1:2525 --to helpdesk@example.test --from ana@example.test \ --header "Subject: Shared drive S: not mapping" --body "Since the update, S: is missing."Or with Python:
import smtplib from email.message import EmailMessage m = EmailMessage(); m["From"] = "ana@example.test"; m["To"] = "helpdesk@example.test" m["Subject"] = "Shared drive S: not mapping"; m.set_content("Since the update, S: is missing.") smtplib.SMTP("127.0.0.1", 2525).send_message(m) - Ingest the inbox:
POST /api/mailserver/ingest. Open Tickets: the mail is a ticket in Storage, with the sender as reporter. - To make this automatic, set
TICKETIQ_MAIL_AUTOSTART=trueandTICKETIQ_MAIL_AUTO_INGEST=trueand restart. - For outbound notices, set
TICKETIQ_MAIL_RELAY_HOST,TICKETIQ_MAIL_RELAY_PORTandTICKETIQ_MAIL_FROM.
Warning
Keep the listener on 127.0.0.1 unless it sits behind your own mail relay. For agent conversations over email, use an email trigger with Allowed senders and authenticated-mail checks.