Sophon Docs
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:

3. Configure in Sophon Dashboard

  1. Go to Channels and click Add Channel
  2. Select Email (IMAP/SMTP)
  3. Fill in the server details (see provider table below)
  4. Enter your email address and app password
  5. Click Test Connection — Sophon will verify both IMAP and SMTP connectivity
  6. Click Activate

Provider Settings

ProviderIMAP HostIMAP PortSMTP HostSMTP Port
Gmailimap.gmail.com993smtp.gmail.com587
Outlook / Hotmailoutlook.office365.com993smtp.office365.com587
Yahoo Mailimap.mail.yahoo.com993smtp.mail.yahoo.com587
iCloud Mailimap.mail.me.com993smtp.mail.me.com587
Custom / Self-hostedYour IMAP server993Your SMTP server587

All connections use TLS/SSL. Port 993 is IMAP over SSL; port 587 is SMTP with STARTTLS.

Configuration Reference

FieldTypeRequiredDefaultDescription
imapHosttextYesIMAP server hostname
imapPortnumberNo993IMAP port (SSL/TLS)
smtpHosttextYesSMTP server hostname
smtpPortnumberNo587SMTP port (STARTTLS)
usernameemailYesEmail address
passwordsecretYesApp password
pollIntervalSecondsnumberNo60How 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:

  1. Connects to IMAP and looks for unread messages in the inbox
  2. Fetches new messages and converts them to SophonMessage format
  3. Extracts file attachments (images, PDFs, etc.) and processes them
  4. Routes the message to the configured agent
  5. 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.