Skip to Content
ChannelsEmail (SMTP / IMAP)

Email Channel (SMTP / IMAP)

An Email channel connects any standard mailbox using SMTP (for sending) and IMAP (for receiving). No third-party email API account is required.

Configuration

On your agent’s page, choose Add an email channel and provide:

FieldNotes
SMTP host, port, securityPort 587 is typically starttls; port 465 is tls.
IMAP host, port, securityPort 993 is typically tls.
Username & passwordUsed for SMTP and IMAP. Use an app password if your provider requires one (e.g., Gmail with 2-step verification). OAuth is not supported.
IMAP folderDefaults to INBOX.
Mailbox addressThe address msend sends as and receives on. Display name and signature are optional.

Existing mail is never imported: Connecting checks both SMTP and IMAP logins, then records the mailbox’s current end position. Only mail arriving after connection is ingested. msend reads with BODY.PEEK and marks a message as read only after it is safely stored.

Polling & Resync

  • Active email channels are polled every 30 seconds (EMAIL_POLL_SECONDS) by a Solid Queue recurring job. Ensure bin/jobs or SOLID_QUEUE_IN_PUMA=1 is running.
  • If the IMAP server changes UIDVALIDITY (renumbering the mailbox), msend automatically resyncs from the current end without importing historical mail.

Threading, Participants & Text Normalization

  • Threads: Keyed by the first ID in References, then In-Reply-To, then the message’s own Message-ID. Subject changes do not split a thread. Outbound replies set In-Reply-To, References, and Re: ... subjects, and record the sent Message-ID as external_id.
  • Participants & addressed_to_agent: Everyone in From, To, and Cc (excluding the mailbox itself) is recorded as a participant. addressed_to_agent is true only when the mailbox is in To. Under the default mentions reply policy, mail where the mailbox is only in Cc is stored but not sent to the agent.
  • Clean Text: message.text strips quoted reply history, signatures, and "Sent from my iPhone" footers so your LLM sees only the new turn. The full original body remains in the stored InboundEvent. Attachments over MAX_ATTACHMENT_BYTES are skipped with a note in text.

Bounces & Auto-Reply Loop Prevention

  • Bounces: A delivery status report or MAILER-DAEMON bounce referencing a sent message marks it failed with error_code: "bounced" and the server’s diagnostic. SMTP 5xx errors fail immediately; 4xx errors and timeouts are retried.
  • Loop Prevention: Mail with Auto-Submitted (other than no), Precedence: bulk / junk / list, or from MAILER-DAEMON, postmaster, or noreply-style senders is stored with metadata.automated = true and not delivered to the agent.
Last updated on