Channels
Email (IMAP/SMTP)
Receive and reply to emails through Sophon.
Sophon connects to any email provider via standard IMAP (receiving) and SMTP (sending) protocols. It polls for new messages on a configurable interval and can reply to emails as your agent.
Prerequisites
- An email account with IMAP and SMTP access enabled
- An app password (recommended over your account password for security)
Step-by-Step Setup
1. Enable IMAP Access
Most email providers require you to explicitly enable IMAP:
- Gmail: Settings > See all settings > Forwarding and POP/IMAP > Enable IMAP
- Outlook.com: Enabled by default
- Yahoo: Settings > More Settings > Mailbox > Enable IMAP
2. Generate an App Password
Using an app-specific password is strongly recommended:
- Gmail: Google App Passwords (requires 2FA enabled)
- Outlook.com: Microsoft App Passwords
- Yahoo: Yahoo App Passwords
3. Configure in Sophon Dashboard
- Go to Channels and click Add Channel
- Select Email (IMAP/SMTP)
- Fill in the server details (see provider table below)
- Enter your email address and app password
- Click Test Connection — Sophon will verify both IMAP and SMTP connectivity
- Click Activate
Provider Settings
| Provider | IMAP Host | IMAP Port | SMTP Host | SMTP Port |
|---|---|---|---|---|
| Gmail | imap.gmail.com | 993 | smtp.gmail.com | 587 |
| Outlook / Hotmail | outlook.office365.com | 993 | smtp.office365.com | 587 |
| Yahoo Mail | imap.mail.yahoo.com | 993 | smtp.mail.yahoo.com | 587 |
| iCloud Mail | imap.mail.me.com | 993 | smtp.mail.me.com | 587 |
| Custom / Self-hosted | Your IMAP server | 993 | Your SMTP server | 587 |
All connections use TLS/SSL. Port 993 is IMAP over SSL; port 587 is SMTP with STARTTLS.
Configuration Reference
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
imapHost | text | Yes | — | IMAP server hostname |
imapPort | number | No | 993 | IMAP port (SSL/TLS) |
smtpHost | text | Yes | — | SMTP server hostname |
smtpPort | number | No | 587 | SMTP port (STARTTLS) |
username | Yes | — | Email address | |
password | secret | Yes | — | App password |
pollIntervalSeconds | number | No | 60 | How often to check for new emails (seconds) |
channels.json Example
{
"id": "email-main",
"type": "email",
"name": "Sophon Email",
"enabled": true,
"config": {
"imapHost": "imap.gmail.com",
"imapPort": "993",
"smtpHost": "smtp.gmail.com",
"smtpPort": "587",
"username": "sophon@yourcompany.com",
"password": "<encrypted>",
"pollIntervalSeconds": "60"
},
"routing": {
"agentId": "default",
"dmBehavior": "main-session"
},
"status": "connected"
}How Polling Works
Sophon checks for new emails at the configured interval:
- Connects to IMAP and looks for unread messages in the inbox
- Fetches new messages and converts them to
SophonMessageformat - Extracts file attachments (images, PDFs, etc.) and processes them
- Routes the message to the configured agent
- Agent's response is sent back as a reply email via SMTP
Troubleshooting
- "Authentication failed" — Use an app password, not your regular account password. For Gmail, you must have 2FA enabled to generate app passwords.
- Connection refused on port 993 — Verify IMAP is enabled for your account. Some providers disable it by default.
- Emails not arriving — Check the poll interval. Default is 60 seconds. Also verify the email account's inbox isn't full.
- "SMTP relay denied" — The SMTP server rejected the send. For Gmail, ensure "Less secure app access" is off and you're using an app password. For custom servers, check relay permissions.
- Attachments not processed — Files over 25 MB are skipped. Check
~/.sophon/documents/uploads/for disk space.