← Back to blog

Connect iCloud Mail to Claude

guidesicloudclaude-code

Claude has built-in connectors for Gmail and Microsoft 365, but not for iCloud Mail. Apple does not offer an OAuth sign-in that other apps can use for mail. What it does offer is IMAP, the standard protocol mail apps have used for decades, with a separate app-specific password for each app.

That is enough to connect iCloud Mail to Claude. This guide uses Fluxmail, a self-hosted MCP server that speaks IMAP to iCloud and MCP to Claude. It runs on your Mac, keeps the password encrypted there, and works with @icloud.com, @me.com, and @mac.com addresses.

1. Create an app-specific password

Apple requires two-factor authentication on your Apple Account before you can create one. Most accounts already have it.

  1. Sign in at account.apple.com.
  2. In Sign-In and Security, select App-Specific Passwords.
  3. Select Generate an app-specific password, name it something like "Fluxmail", and copy the password.

Use this password only for Fluxmail. If you stop using it, revoke it on the same page without changing your Apple Account password.

2. Connect the mailbox

Install the Fluxmail CLI and create the local administrator:

npm install -g fluxmail
fluxmail setup --name "Your name" --email you@example.com

Then connect iCloud with Apple's server settings:

fluxmail accounts add imap \
  --email johnappleseed@icloud.com \
  --imap-host imap.mail.me.com \
  --imap-user johnappleseed \
  --smtp-host smtp.mail.me.com

Replace both occurrences of johnappleseed with your own address. The IMAP username is only the part before the @, while SMTP uses the full address, which is Fluxmail's default. Fluxmail's other defaults already match iCloud: IMAP over TLS on port 993 and SMTP with STARTTLS on port 587.

Fluxmail prompts for the password without showing it. Paste the app-specific password. It is used for both IMAP and SMTP. Fluxmail tests both connections before saving, then encrypts the password in its local database.

If the IMAP login fails with the short username, try the full address with --imap-user johnappleseed@icloud.com. Apple suggests that as a fallback.

3. Connect Claude

For Claude Code, add Fluxmail as an MCP server. Start with read-only access while you try it out:

claude mcp add fluxmail -- fluxmail stdio --profile read-only

For Claude Desktop, open Settings > Developer > Edit Config and add this to claude_desktop_config.json:

{
  "mcpServers": {
    "fluxmail": {
      "command": "fluxmail",
      "args": ["stdio", "--profile", "read-only"]
    }
  }
}

Restart Claude Desktop after saving. If it cannot find the fluxmail command, run which fluxmail in Terminal and use the full path it prints.

Now ask Claude something only your inbox can answer:

What are the five most recent emails in my iCloud inbox? Which ones look like they need a reply?

Claude searches with Fluxmail's search_emails tool and opens messages with get_email. Everything it reads comes straight from Apple's servers.

4. Allow more when you need it

Read-only is right for summaries and search. To let Claude organize mail and write drafts, switch the profile to read-write. To let it send, use full. For Claude Code, remove and re-add the server:

claude mcp remove fluxmail
claude mcp add fluxmail -- fluxmail stdio --profile read-write

With read-write, Claude can file messages into your iCloud folders and save drafts that appear in Mail on your Mac and iPhone. You still send them yourself. IMAP mailboxes have folders but no labels, so ask Claude to move messages rather than label them.

If something looks off

  • A folder is missing. Fluxmail finds Sent, Drafts, Trash, Archive, and Junk from the folder flags iCloud reports. If it warns that one is missing, set it by name with fluxmail accounts configure <account-id> --trash-folder 'Deleted Messages'. Get the account ID from fluxmail accounts list.
  • Sent messages appear twice. Some servers save a copy of mail sent over SMTP on their own. If you see duplicates in Sent, run the fluxmail accounts add imap command again with --no-save-sent added.
  • An iCloud+ custom domain. You can send from a custom domain address that belongs to your account. Register it in Fluxmail first, as described in Send from another address.

Other IMAP providers

The same steps work for Fastmail, Yahoo, Zoho, and most other providers: create an app password, look up the provider's IMAP and SMTP hostnames, and run fluxmail accounts add imap. Connect IMAP/SMTP covers the options.

Next steps