Skip to content

Improvement: imap-smtp cannot express split IMAP/SMTP auth — one connector, two services #2879

Closed

Description

@Israeltheminer

Problem

imap-smtp is the only shipped connector that talks to two independently
authenticated services
— an IMAP server and an SMTP server. Its contract
assumes they are one:

# configs/platform/system/connectors/imap-smtp/connector.yml
configFields:
  - key: imapHost   required: true
  - key: imapPort   default: 993
  - key: smtpHost   required: true
  - key: smtpPort   default: 587
  - key: security   enum: [tls, starttls]   # "Transport security for both servers."
  - key: sentMailbox
auth:
  - method: basic                            # one username + password

One basic credential and one security value cannot describe a mailbox read
over IMAPS while mail is sent through a separate transactional provider — a
mainstream self-hosted setup:

host port transport login
IMAP private mailbox 993 TLS mailbox user + password
SMTP a transactional email provider 587 STARTTLS provider user + API key

security: tls breaks the SMTP leg; starttls breaks the IMAP leg. There is
also no fromAddress, which such a setup needs.

This worked before the AI-backend rewrite: the retired integrationCredentials
row carried separate basicAuth and smtpAuth blocks plus a
connectionConfig with independent imapSecure / smtpSecure.

Current behaviour

Multi-credential is already supported and is not the gap — the schema calls
cardinality "the headline fix", and resolveConnectorCredential takes a
credentialRef ("a credential id or its human name; omitted means the
organization's default").

What is missing is selection from a workflow. credentialRef is threaded
through lib/connectors/dispatcher.ts, lib/chat/capabilities.ts,
convex/connectors/hostcall_token.ts and executeConnectorAction, but the
engine's node document has no credential key — lib/engine/core/validate/nodes.ts
and lib/engine/core/types.ts never mention one. A connector node carries only
type and input:

# configs/platform/custom/automations/imap-smtp/triage-inbox/workflow.yml
- id: fetch
  type: imap-smtp.list_messages
  input: { limit: '…', mailbox: INBOX }

So chat can name a credential and an automation cannot — every node resolves the
org default. Two credentials can exist; a workflow cannot choose between them.

Why no other connector hits this

All 16 shipped connectors declare exactly one auth method, and every other one
addresses a single service:

  • github, discord — one API, one bearer
  • confluence, shopify — endpointMode: per-credential, i.e. different
    instances of the same service, still one credential per invocation
  • gmail, outlook, slack, teams — one OAuth grant covering read and write

auth being an array means multi-method is declarable, but nothing exercises it.
So this is not an oversight in one connector — the model has no shape for
"one connector, two services", and imap-smtp is the first case to need one.

Proposed change

Three options, ascending in blast radius. Filing as needs discussion because
the choice is a product/architecture call, not a mechanical fix.

  1. Per-node credential selection. Add an optional credential: to connector
    nodes, threaded to the credentialRef that already exists end to end.
    Smallest change and useful on its own (it also lets an automation address a
    specific instance of a per-credential connector). Insufficient alone here:
    security and the host config still come from one credential's config.
  2. Split the transport config — imapSecurity / smtpSecurity instead of one
    security, and add fromAddress. Config-only, touches no credential model.
    Needed regardless of 1 or 3.
  3. Per-action auth. Let a connector declare which auth entry an action uses,
    so list_messages and send resolve different credentials. The general fix,
    and the most invasive.

1 + 2 appears to be the smallest combination that supports the table above.

Acceptance criteria

  • A mailbox read over IMAPS on 993 and sent through a separate provider over
    STARTTLS on 587, with different logins, can be configured through the UI.
  • The inbound sync and the outbound send each resolve their own credential.
  • fromAddress is expressible.
  • An automation can name which credential a connector node uses, or the chosen
    alternative is documented.
  • Existing single-service connectors keep working with one credential and no
    config change.

Activity

  1. added
    priority: medium
    needs discussion
    improvement
    service: platform
    on Jul 30, 2026
  2. Israeltheminer commented on Aug 6, 2026

    @Israeltheminer
    ContributorAuthor

    Resolved. Option 1 (per-node credential selection) was not taken — the second branch of the last acceptance criterion was: one automation covers every connection, and the behaviour is documented.

    How each criterion is met

    A mailbox read over IMAPS on 993 and sent through a separate provider over STARTTLS on 587, with different logins, configurable through the UI.
    #2892 added the optional separate SMTP login (smtpUsername / smtpPassword) alongside the mailbox login, wired through auth injection, the native transport, and a toggle on the credential form. #2896 made well-known ports own the TLS mode — 993/465 implicit, 143/587 STARTTLS — so the shared security select can no longer pair tls with 587 and produce OpenSSL's wrong version number. security survives only as the fallback for a non-standard port.

    The inbound sync and the outbound send each resolve their own credential.
    mailboxConfigFromCredential builds separate imap and smtp auth blocks from one row: the SMTP leg uses the relay login when one is stored and the mailbox login otherwise. A half-entered relay login is refused rather than silently mixed with the mailbox pair.

    fromAddress is expressible.
    #2924 declared it as a config field and mirrors it from the IMAP login on write, healing rows written before the mirror existed on the next sync pass. It is server-owned rather than a second input, because From and the mailbox login are one answer.

    An automation can name which credential a connector node uses, or the chosen alternative is documented.
    The alternative. #2915 gave each mail credential its own sync watermark; #2916 made conversation.sync_mailbox and the new conversation.list_mailbox_messages walk every active credential on the connector, each from its own watermark, with a failing mailbox isolated and reported in inbound.reason instead of aborting the pass. One automation therefore covers every connected mailbox and no node needs to name one. Documented in en / de / fr under platform/admin/connectors, platform/automations/builtin and develop/connectors.

    Existing single-service connectors keep working with one credential and no config change.
    Unchanged — resolution still falls back to the connector's default credential everywhere else.

    On the proposed options

    Option 2 landed by a different route than proposed: rather than splitting security into imapSecurity / smtpSecurity, the port decides the transport. That also repairs credentials already saved with a mismatched pair, without a migration.

    Option 3 (per-action auth) stayed unbuilt and is not needed for this shape: one credential row carries both logins, so list_messages and send already authenticate as different identities against different servers.

    Not part of this issue, but noticed while confirming it

    lib/connectors/registry.ts still lists credential in a connector node's allowedFields, while NodeDef has no such field and the stepper passes no credentialRef. The node inspector reads allowed fields generically, so a Credential box renders on connector nodes, persists whatever is typed into the document, and the run ignores it. develop/connectors.md also describes pointing an automation at a different credential name as a supported seam. Either the field goes or it gets wired — neither affects the mailbox case above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    improvementneeds discussionpriority: mediumservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions