?

Overview

rousseau email runs the email bridge: IMAP for inbound polling, SMTP for outbound sending. It polls INBOX (or another mailbox) for UNSEEN messages, routes each into the agent, and sends the reply via SMTP. Both connections use TLS. IMAP IDLE is not yet supported — set poll_interval accordingly.

Source: internal/cli/email.go. Transport: internal/transport/email/.

Synopsis

rousseau email [--imap-addr host:port] [--imap-username u] [--imap-password p] \
               [--smtp-addr host:port] [--smtp-username u] [--smtp-password p] \
               [--from addr] [--mailbox INBOX] [--poll-interval 30s]

Flags

Flag Type Default Effect
--imap-addr string email.imap_addr IMAP host:port.
--imap-username string email.imap_username IMAP username.
--imap-password string email.imap_password IMAP password. Prefer env vars.
--smtp-addr string email.smtp_addr SMTP host:port.
--smtp-username string email.smtp_username SMTP username.
--smtp-password string email.smtp_password SMTP password. Prefer env vars.
--from string email.from From: address.
--mailbox string email.mailbox (defaults to INBOX) IMAP mailbox to poll.
--poll-interval duration string email.poll_interval (built-in default 30s) Poll cadence.

Config keys respected

internal/config/config.go EmailConfig:

Key Type Default Effect
email.imap_addr string empty Required.
email.imap_username string empty Required.
email.imap_password string empty Required.
email.smtp_addr string empty Required.
email.smtp_username string empty Required.
email.smtp_password string empty Required.
email.from string empty Required.
email.mailbox string INBOX Polled mailbox.
email.poll_interval duration 30s Cadence.
email.reply_header string empty Prefix on outbound messages.

Allowlist syntax

Email has no --allow flag — the whole point of the From:/Reply-To: model is that anyone can send. Filtering happens at the mail-server side (postfix ACLs, Gmail filters, etc.), not in the router.

Environment variables

Variable Effect
ROUSSEAU_EMAIL_IMAP_ADDR Override IMAP address.
ROUSSEAU_EMAIL_IMAP_USERNAME Override IMAP username.
ROUSSEAU_EMAIL_IMAP_PASSWORD Override IMAP password.
ROUSSEAU_EMAIL_SMTP_ADDR Override SMTP address.
ROUSSEAU_EMAIL_SMTP_USERNAME Override SMTP username.
ROUSSEAU_EMAIL_SMTP_PASSWORD Override SMTP password.
ROUSSEAU_EMAIL_FROM Override From address.

Startup sequence

  1. Validate IMAP and SMTP settings; fail if any required field is empty.
  2. Default claudecli.permission_mode to bypassPermissions.
  3. Parse poll_interval duration.
  4. Open session store, build agent wiring.
  5. email.New — instantiate the transport.
  6. wiring.startCron — cron delivery via SMTP.
  7. IMAP poll loop until context cancelled.

Exit codes

Code Meaning
0 Clean context cancellation.
1 Missing IMAP/SMTP settings, invalid duration, TLS failure, provider/store error.
130 SIGINT.

Worked examples

# Gmail app password + implicit TLS
rousseau email \
  --imap-addr imap.gmail.com:993 \
  --imap-username bot@example.com \
  --imap-password "$IMAP_APP_PW" \
  --smtp-addr smtp.gmail.com:465 \
  --smtp-username bot@example.com \
  --smtp-password "$SMTP_APP_PW" \
  --from bot@example.com

# From config, poll every 2 minutes
cat > ~/.config/rousseau/config.yaml <<'EOF'
email:
  imap_addr: imap.example.com:993
  imap_username: bot@example.com
  imap_password: "$IMAP_APP_PW"
  smtp_addr: smtp.example.com:465
  smtp_username: bot@example.com
  smtp_password: "$SMTP_APP_PW"
  from: bot@example.com
  mailbox: INBOX
  poll_interval: 2m
EOF
rousseau email

Common failure modes

  • AUTHENTICATIONFAILED — bad IMAP credentials or missing app-password (Gmail, Outlook require app-passwords).
  • STARTTLS is not supported — the server offers only STARTTLS; not implemented.
  • Duplicate replies — the bot is not marking messages read; verify mail is flagged SEEN after processing.
  • SMTP 550 5.7.1 relay denied — SMTP host requires authenticated SMTP; verify username/password.

Related pages

Type to search 150+ pages. Ranking: BM25 with title/description boost.