Skip to main content
connic
Connectors

Email

Start agents from incoming email over IMAP and send their replies or notifications over SMTP.

Last updated
ModesInbound, outbound
YAML typeemail
CredentialsA Connection of type email with IMAP settings, SMTP settings, or both: IMAP for inbound, SMTP for outbound.
BridgeOn the Connection, to reach an IMAP or SMTP server in a private network
Custom domainNot supported
Linked agentsOne or more. An email starts every linked agent.
While pausedInbound stops checking the mailbox. Mail that arrives meanwhile stays there and is processed after Resume if it still matches Unread Only and the filters. Outbound sends nothing.

Set up

  1. Have the mail server settings ready: host, port, username, and password of the IMAP server for inbound, or the host and port of the SMTP server, plus its login if it needs one, for outbound.

  2. Open the agent. In Connector Flow, click Add inbound connector for inbound or Add outbound connector for outbound. Then click Create New Connector and choose Email (SMTP/IMAP).

  3. Choose the mode, Inbound (IMAP) or Outbound (SMTP). Under Connection, pick a saved Connection or create one with the mail server settings. If the mail server is in a private network, select the Bridge in the Connection.

  4. For inbound, set the folder and filters under Email Filters. For outbound, enter the From Address and, optionally, a From Name and Default Recipient.

  5. Click Create. An inbound connector starts checking the mailbox. For outbound, choose how the agent uses the connector and click Link connector.

In code

Declare the connector in connectors/*.yaml. connection names the Connection that holds the mail server settings.

connectors/support-inbox.yaml
type: email
mode: inbound
connection: support-mailbox   # Connection with the mail servers and optional Bridge
config:
  mailbox: INBOX
  filter_from: "@example.com"
agents:
  - support-triage
connectors/support-replies.yaml
type: email
mode: outbound
connection: support-mailbox
config:
  from_address: support@example.com
  from_name: Support Team
agents:
  - name: support-triage
    outbound: { usage: automatic }

Configuration

The fields of an email connector, the same in connectors/*.yaml, the REST API, and connic MCP. The descriptions name the matching setting in the dashboard. Connectors in code describes the fields every connector shares, such as agents and environments.

FieldTypeStatusDescription
typestringRequiredemail.
modestringRequiredinbound or outbound. Dashboard: Mode.
connectionstringRequiredName or ID of a Connection of type email. It must hold the IMAP settings for inbound and the SMTP settings for outbound; one Connection can hold both. The Connection also holds the Bridge. See Mail server settings. Dashboard: Connection.
configobjectOptionalEmail settings.
mailboxstringOptionalInbound. The folder to check, such as INBOX or Support. Dashboard: Mailbox/Folder.Default: INBOX
filter_unread_onlybooleanOptionalInbound. Process only unread mail. With false, mail that was already read is processed too. Dashboard: Unread Only.Default: true
mark_as_readbooleanOptionalInbound. Mark an email as read once it has started its runs. Filtered-out mail stays unread. Dashboard: Mark as Read.Default: true
filter_fromstringOptionalInbound. Process only mail whose sender address contains this text, ignoring case, such as @example.com. Dashboard: Filter by Sender.
filter_subjectstringOptionalInbound. Process only mail whose subject contains this text, ignoring case, such as [Support]. Dashboard: Filter by Subject.
from_addressstringRequiredOutbound, required there. The sender address; it must contain @. Dashboard: From Address.
from_namestringOptionalOutbound. Display name of the sender. Dashboard: From Name.
default_tostringOptionalOutbound. Recipient when the output or payload has no to: one address or comma-separated addresses. Dashboard: Default Recipient.

Agent input

Modes: Inbound

An inbound connector checks the folder over IMAP and starts a run for every linked agent with each new email that matches its filters. The first checks also process the matching mail already in the folder, by default every unread email, oldest first. connic remembers how far it got, so an email isn't processed twice, even with Mark as Read off. Changing the folder, the IMAP server, or the username starts again at the beginning of the folder. The run receives the parsed email:

payload.json
{
  "subject": "Help with order #12345",
  "from": "Jane Doe <jane@example.com>",
  "from_address": "jane@example.com",
  "to": "support@example.com",
  "date": "Mon, 12 Oct 2026 10:30:00 +0200",
  "message_id": "<abc123@mail.example.com>",
  "body_text": "Hi, my order hasn't arrived yet...",
  "body_html": "<p>Hi, my order hasn't arrived yet...</p>",
  "has_attachments": true,
  "attachments": [
    {
      "filename": "receipt.pdf",
      "content_type": "application/pdf",
      "size_bytes": 45678,
      "content": "JVBERi0xLjQK...",
      "encoding": "base64"
    },
    {
      "filename": "notes.txt",
      "content_type": "text/plain",
      "size_bytes": 256,
      "content": "Order notes: ...",
      "encoding": "text"
    }
  ],
  "_email": {
    "connector_id": "550e8400-e29b-41d4-a716-446655440000",
    "mailbox": "INBOX",
    "uid": "4821",
    "timestamp": "2026-10-12T08:30:05.123456"
  }
}
  • from and to are the decoded headers; from_address is the bare sender address.
  • date and message_id are the Date and Message-ID headers as sent.
  • body_text and body_html are the plain-text and HTML parts. Either can be empty.
  • _email names the connector, the folder, and the message's IMAP UID.

Attachments

Each attachment lists its filename, content_type, and size_bytes. Text, JSON, and XML files carry their content as text ("encoding": "text"), all other files as base64 ("encoding": "base64"). The model receives each attachment as its own file and the rest of the email as text.

Included types: JPEG, PNG, GIF, WebP, BMP, and TIFF images; PDF, plain text, CSV, Markdown, HTML, JSON, and XML; Word, Excel, and PowerPoint files, including the older .doc, .xls, and .ppt formats; and ZIP archives. Whether the model can read a type depends on the model; see file input for connic/* models.

connic skips images smaller than 1 KB, inline images smaller than 50 KB, and common tracking and logo files such as favicon.ico, spacer.gif, and logo.png. Skipped files don't appear in the payload.

An email takes up to 50 attachments, at most 32 MiB combined, measured after decoding. At the first attachment over a limit, connic keeps the attachments before it and omits that one and all later ones. Files of other types are omitted too. An omitted attachment has "content": null and a file_issue, and the payload lists every omission in file_issues:

omitted attachment
{
  "filename": "archive.rar",
  "content_type": "application/vnd.rar",
  "size_bytes": 20480,
  "content": null,
  "content_omitted": true,
  "file_issue": {
    "code": "unsupported_file_type",
    "message": "File type is not supported.",
    "retryable": false,
    "name": "archive.rar",
    "size_bytes": 20480
  }
}

For emails larger than 10 MiB, connic reads the headers, the text, and each attachment separately, within the same limits. The agent receives the email even when no attachment was accepted. Turn on Files required for an agent in the connector's details drawer, or set files_required: true on its link in YAML, to fail the run before it starts when an attachment is missing or was omitted.

Mail server settings

The server settings live on the Connection, not on the connector, and connic stores them encrypted. Manage Connections under Project Settings → Connections; a changed Connection applies to every connector that uses it. A Connection holds the IMAP settings, the SMTP settings, or both, and each connector reads the set for its mode: inbound needs the IMAP host, username, and password, outbound the SMTP host.

SettingModeDescription
IMAP HostInboundThe IMAP server, such as imap.gmail.com.
IMAP PortInboundDefault 993. Usually 993 with SSL/TLS and 143 without.
Use SSL/TLSInboundOn by default. connic uses TLS from the start of the connection. Off means an unencrypted connection; connic doesn't upgrade IMAP with STARTTLS.
IMAP UsernameInboundUsually the email address.
IMAP PasswordInboundThe password or an app password.
SMTP HostOutboundThe SMTP server, such as smtp.gmail.com.
SMTP PortOutboundDefault 587.
Use TLS (STARTTLS)OutboundOn by default. On port 465, connic uses TLS from the start of the connection. On other ports, it connects unencrypted and upgrades the connection with STARTTLS.
SMTP UsernameOutboundUsually the email address. Optional together with the password: leave both empty for a relay that accepts mail without a login.
SMTP PasswordOutboundThe password or an app password. Set it together with the username.
SSL CA Certificate PEMInbound, outboundOptional. The CA certificate in PEM format for a mail server whose certificate comes from a private CA. connic trusts it in addition to the public CAs, for IMAP and SMTP.
BridgeInbound, outboundOptional. The Bridge that reaches a mail server in a private network. Without one, connic connects only to public addresses. The REST API and connic MCP take it as the Connection's top-level bridge.

connic verifies the mail server's TLS certificate whenever it uses TLS, including through a Bridge, and verification can't be turned off. The certificate must come from a public CA or from the CA in SSL CA Certificate PEM, which covers mail servers with a certificate from a private CA, and it must be valid for the IMAP or SMTP host as you entered it. If the host doesn't match, enter the hostname the certificate was issued for, such as mail.example.com instead of an IP address; adding a CA doesn't fix a mismatch. Through a Bridge, the hostname is resolved on your network, so an internal name works. If a check fails, connic doesn't connect, and the error in the connector's logs or runs names the host and the failed check.

Every connector that uses the Connection goes through its Bridge. To use a different Bridge per environment, give each environment its own Connection; see Connections and Bridges. When you change a host, port, TLS setting, username, or the Bridge of a saved Connection, enter the password for that server again, and the CA certificate if the Connection has one; connic refuses the change otherwise.

Gmail needs an app password instead of the account password. Turn on 2-Step Verification for the Google account, create an app password in its security settings, and use the 16-character password for IMAP and SMTP.

Outbound delivery

Modes: Outbound

An outbound email connector sends one email over SMTP each time it's used: when a linked agent's run completes, when the model calls it as a tool, or when middleware calls it, depending on the link's usage. The email comes from the From Address, with the From Name when set. These fields control it:

FieldDescription
toRecipients: one address, comma-separated addresses, or a list.
ccCopy recipients, in the same formats as to.
bccBlind copy recipients, in the same formats as to.
subjectThe subject line.
bodyThe plain-text body.
html_bodyAn HTML version. The email then has both parts, with body as the plain-text alternative.
reply_toThe Reply-To address.

The recipients come from to, then the connector's Default Recipient, then the sender of the email that started the run, when an email connector started it. Without any of these, the send fails with missing_recipient. The subject comes from subject, then the subject of the email that started the run with Re: in front unless it already has one, then Agent Response. A reply carries no In-Reply-To header, so some mail clients don't show it in the original thread. Outbound emails have no attachments.

Automatic output

An automatic link turns the run's final output into an email. Plain text, and any output that isn't a JSON object, becomes the body. A JSON object sets the fields above, and also accepts message for body and html for html_body. Give the agent an output schema to make it return these fields.

output.json
{
  "to": "jane@example.com",
  "subject": "Re: Help with order #12345",
  "body": "Your order shipped this morning.",
  "html_body": "<p>Your order shipped this morning.</p>"
}

Agent-tool and middleware payload

The model or middleware passes the fields above as the payload. body is required and all other fields are optional; message, html, and any other field are rejected. connic adds the sender, the SMTP settings, and the retries, none of which the model sees.

connector-payload.json
{
  "body": "Your request has been resolved.",
  "to": ["jane@example.com"],
  "subject": "Re: Your support request",
  "html_body": "<p>Your request has been resolved.</p>",
  "cc": ["manager@example.com"],
  "bcc": ["archive@example.com"],
  "reply_to": "support@example.com"
}

Delivery and retries

connic logs in with the Connection's SMTP username and password, if it has them, and sends the email to every address in to, cc, and bcc. A failed send is tried 3 times in total, waiting 1 and then 2 seconds between attempts, each with a 30-second timeout. The connector's runs show each delivery with its error.

Limits and errors

LimitValue
Mailbox checksAbout every 30 seconds
Emails per checkUp to 100. The rest follow in later checks.
Attachments per email50, at most 32 MiB combined, measured after decoding
SMTP delivery3 attempts, 1 and then 2 seconds apart, each with a 30-second timeout

Inbound problems, such as a rejected login or an unknown folder, appear in the connector's logs as IMAP poll error, and the next check tries again. Every processed email appears in the connector's runs with the number of agents it started. If a run can't be started, connic retries the email on the next check; agents that already received it don't get a second run. connic skips an email after 3 failed reads caused by the email itself, so later mail isn't held up. Such a read fails when connic can't parse the email, when the server returns a different size than it announced, or when fetching the email times out. A skipped email stays unread and appears in the connector's runs as failed. Temporary server errors, such as throttling or a dropped connection, never count toward the 3 reads; the next check tries the email again.