Skip to content

Connect Email (IMAP / Other email)

This guide walks you through connecting a mailbox to Pinchy using standard IMAP (for reading) and SMTP (for sending) — the protocol almost every email provider supports. Use this when your provider isn’t Gmail or Microsoft 365: Fastmail, iCloud, GMX, Zoho, a company mail server, or anything you self-host.

Unlike Google and Microsoft, there’s no OAuth app to register first. You connect a mailbox directly with its server settings and a password — one step, no separate “app” to manage.

  • You’re logged in as an admin in Pinchy
  • Your email address
  • An app-specific password, if your provider supports one

You’ll also need your IMAP and SMTP server hostnames and ports — but Pinchy tries to fill these in for you automatically, so you often don’t need to look them up.

  1. Open the Add Integration wizard

    In Pinchy, go to Settings → Integrations, click Add Integration, then select IMAP / Other email.

  2. Enter your details

    Three fields are all most mailboxes need:

    • Your name (optional) — shown to recipients when an agent sends email from this mailbox (Clemens Helm <clemens@example.com> instead of a bare address).
    • Email address — when you tab away from this field, Pinchy looks up your provider’s server settings automatically (via its built-in provider list and your domain’s DNS records).
    • Password — use an app-specific password if your provider requires one (see the caution above).
  3. Check the server settings

    If Pinchy found your provider’s settings, they appear as a one-line summary — you don’t need to touch them. Click Edit server settings if you want to inspect or change them.

    If your provider wasn’t recognized, the server fields open up pre-filled with a best guess. Verify them against your provider’s documentation:

    • IMAP host and IMAP port — usually port 993
    • SMTP host and SMTP port — usually port 465 or 587
    • Username — pre-filled with your email address, which is what almost every provider expects
    • Security — leave on Automatic (TLS); Pinchy picks implicit TLS or STARTTLS based on the port. None disables encryption entirely and is only for special setups like a local Proton Mail Bridge.

    Your provider’s help pages usually list these under “IMAP/SMTP settings” or “set up a mail client.” Search for <your provider> IMAP settings if you’re not sure.

  4. Test & Save

    Click Test & Save. Pinchy logs in to both the IMAP and SMTP servers and, if both succeed, saves the connection in one step — a broken connection can’t end up saved and silently unusable.

    If the test fails, the server settings open up with a specific failure reason — wrong credentials, unreachable host, or a TLS mismatch — so you can correct them and try again.

    The mailbox then appears in the Integrations list, named after its email address (rename it anytime from the list), ready to grant to agents.

A connection alone doesn’t give any agent access. You must explicitly grant permissions per agent — the same model used for Gmail and Microsoft 365.

  1. Open the agent you want to connect to email

  2. Click the gear icon to open Agent Settings

  3. Select the Permissions tab

  4. In the Email section, select the connected account and check the operations this agent may perform:

    • Read messages — list, read, and search emails
    • Create drafts — create draft emails (saved but not sent)
    • Send messages — send emails immediately (cannot be undone)
  5. Click Save & Restart and confirm. Permission changes restart the agent runtime, so active chats are briefly disconnected.


Open the agent’s chat and try a few queries:

  • “Show me my latest unread emails”
  • “Search for emails from max@example.com about invoices”
  • “Draft a reply to the last email saying we’ll process it today”
  • “How many unread emails do I have?”

When email permissions are granted, the agent gets access to these tools — the same set used for Gmail and Microsoft 365:

Tool Permission required Description
email_list Read List emails from a folder (INBOX, SENT, DRAFTS, TRASH, SPAM; defaults to INBOX). Supports filtering by read status.
email_read Read Read the full content of a specific email by ID. Lists any attachments with their IDs. Opens the message’s own folder automatically.
email_get_attachment Read Download an email attachment into the agent’s workspace. Opens the message’s own folder automatically.
email_search Read Search emails using structured fields: from, to, subject, text, unread, sinceDays, folder, limit (e.g. { from: "user@example.com", subject: "invoice", sinceDays: 7 }).
email_draft Draft Create a draft email. Saved directly to the mailbox’s Drafts folder over IMAP. One recipient per call: to takes a single address (a display name with a comma goes in double quotes, "Müller, Hans" <hans@example.com>), and a list is refused — to reach several people, the agent sends separate emails.
email_send Send Send an email immediately over SMTP. Can also send replies with replyTo. One recipient per call: to takes a single address (a display name with a comma goes in double quotes, "Müller, Hans" <hans@example.com>), and a list is refused — to reach several people, the agent sends separate emails.

“Authentication failed — check the username and password”

The most common cause is using your regular account password instead of an app-specific password on a provider that requires one. Generate an app password in your provider’s account settings and use that instead.

“Could not connect to the server — check the host and port”

The IMAP or SMTP host is unreachable — a typo in the hostname, a firewall blocking the port, or a provider that uses non-standard ports. Double-check the values against your provider’s documented IMAP/SMTP settings.

“Could not establish a secure connection — check the security setting”

The Security setting doesn’t match what the server expects. Try TLS for port 993 (IMAP) or 465 (SMTP submission), and STARTTLS for port 587.

“Connection timed out — check the host and port”

The server didn’t respond in time — usually a network issue or an incorrect host/port combination.

“Blocked: enter the mail server as a plain host name or IP address”

The IMAP or SMTP host contains something a host name can’t — usually a stray space, brackets around an IPv6 address, or a port. Enter just the name or address; the port has its own field. See Mail servers on your own network for the full rule.

“Blocked: this host resolves to a private network address”

See Mail servers on your own network below.

“Message … is too large to fetch”

IMAP has no way to hand over a single attachment on its own — the whole message comes down in one piece, attachments included — so an agent reading a message loads all of it into memory at once. To keep one oversized message from taking the agent down with it, we check the size the server reports before downloading and refuse anything over 50 MB. That’s the message as it travels, which is roughly a third larger than the files inside it, so a mail carrying an attachment at the 25 MB cap still comes through.

The message itself is fine, and email_list and email_search still show its sender, subject and date. Only its body and attachments are out of reach. Gmail and Microsoft 365 have no equivalent limit — they can fetch one attachment at a time.


The connection test reports exactly why an attempt failed — refused, timed out, TLS error, wrong password. That’s what makes it useful for fixing a mailbox, and it’s also what would make it useful for mapping the network Pinchy runs in. So we only probe hosts that resolve to a public address.

If your mail server genuinely lives on your own network — an on-premise Exchange or Dovecot box on 10.x, 172.16–31.x, 192.168.x, a Tailscale address (100.x), an IPv6 unique-local address, or any other of the private ranges — add this line to your .env:

Terminal window
ALLOW_PRIVATE_MAIL_HOSTS=1

Then run docker compose up -d so the Pinchy container picks it up.

Loopback, link-local, the cloud metadata endpoints and the reserved ranges stay blocked either way — 127.0.0.1, ::1, 0.0.0.0/8, 169.254.169.254, the documentation ranges, multicast and the rest of the always-refused list. No mail server lives there, so there’s nothing to trade off.

The host itself has to be a plain host name or IP address — imap.example.com, mail.example.com., 93.184.216.34 or 2606:4700:4700::1111. Spaces, brackets ([2606:4700:4700::1111]), a % or zone ID (fe80::1%eth0), a port (mail.example.com:993) and non-ASCII characters are refused, whatever is set. We check the host exactly as the mail client will use it, so it has to be a string every resolver reads the same way. For an internationalised domain, enter its xn-- form: mail.xn--bcher-kva.example rather than mail.bücher.example.

The same check runs when the connection is saved, and again every time the saved IMAP and SMTP hosts are used — before an agent’s email tools receive the connection, before Test connection, and before each inbox sweep. So a mailbox saved under older rules, or before the flag was removed, can’t quietly keep reaching a host that’s refused now. The agent’s email tools keep a connection they already fetched for up to 5 minutes, so after removing ALLOW_PRIVATE_MAIL_HOSTS run docker compose up -d --force-recreate openclaw if a stricter rule must apply at once. A refusal leaves the stored password alone: the agent’s tool reports why, an automation on that mailbox shows an error, and the audit trail records it as integration.credentials_denied with the reason destination-blocked.

Two gaps remain. The check resolves the hostname, and the mail client resolves it again to connect, so a DNS answer that changes in between (DNS rebinding) isn’t caught. And the check runs in Pinchy’s container while the mail tools connect from the agent runtime’s (openclaw): our docker-compose.yml gives both the same extra host names, but if you add extra_hosts entries of your own to openclaw, add them to pinchy too — a name the check can’t resolve is let through.

On OrbStack, host.docker.internal and ollama.local (which our docker-compose.yml maps to the same host gateway) resolve to 0.250.250.254 and are refused whatever you set; use the mail container’s name or your machine’s LAN address when developing.


Pinchy runs the connection test from the exact server that will send your mail — so if the SMTP leg times out or gets refused, that’s real evidence about what this server can reach, not a guess. We use it: on a connection timeout or refusal, we also probe the standard SMTP ports (465, 587, 25) directly from the container, and if a different port is reachable, we show a banner with a one-click “Switch & retry” button for it. Click it and we update the SMTP port and security setting for you and re-run the test — nothing switches silently.

Cloud providers block outbound mail ports by default on new servers — it’s an anti-spam measure, not a Pinchy limitation. The exact ports blocked vary by provider:

Provider Blocked outbound Open Unblocking
Hetzner 25, 465 587 Usually opens automatically after ~1 month of account age, or via a support ticket
DigitalOcean 25, 465, 587 none by default Open a support ticket requesting outbound mail ports be unblocked
AWS / GCP / Azure 25 465, 587 Port 25 stays blocked by policy; use 465 or 587 instead

Port 587 (STARTTLS submission) is the safest default for a new cloud server — it’s the one port most providers leave open. Port 465 (implicit TLS) is the next most likely to work. Port 25 (unencrypted SMTP relay) is blocked almost everywhere and isn’t worth troubleshooting for outbound mail.

You can check the same thing Pinchy’s probe checks, directly from the server (or a shell on the same host):

Terminal window
# Raw TCP reachability (no TLS, no auth) — mirrors what Pinchy's probe does
nc -vz smtp.example.com 587
# Full TLS handshake against an implicit-TLS port (465)
openssl s_client -connect smtp.example.com:465

nc reporting “succeeded” (or openssl reaching a certificate dump instead of hanging) means the port is reachable from this server. A hang followed by nothing means it’s filtered — usually the host’s outbound firewall, not your mail provider.

If every standard port is blocked (Pinchy’s “all outbound SMTP ports appear blocked” banner), the fix has to happen at the host level:

  • Hetzner: open a support ticket asking to unblock outbound SMTP for your server/project. New accounts are usually auto-unblocked after roughly a month of account age.
  • DigitalOcean: open a support ticket from the control panel requesting outbound mail ports be enabled for your account.
  • AWS / GCP / Azure: port 25 is blocked by long-standing policy and generally isn’t unblocked on request — use port 465 or 587 instead, which these providers leave open.