Mail client setup via API and MCP

Give a user the same password-free server settings, sending status, delegated shared-mailbox folders, and app-specific guidance shown in Apps & devices.

Passwords stay with the user. Neither endpoint nor either MCP tool returns a mailbox password or a custom SMTP provider secret. The user enters the mailbox password directly in the email app.

Retrieve setup information

GET /api/v1/mailboxes/{mailbox_id}/client-setup?lang=en
Authorization: Bearer tm_live_...

The response includes the IMAP and SMTP host, port, security, username, real sending readiness, and localized three-step guides for Gmail, Outlook, Apple Mail, Thunderbird, and another IMAP app.

For a regular mailbox that belongs to team inboxes, shared_mailboxes reports durable access readiness, exact Inbox/Sent/Archive/Junk paths, read/flag/folder/move/delete/send-as capabilities, and effective send_as_ready/send_as_reason. The Can reply permission may be present while SMTP is unavailable, so check both readiness fields. An inactive, sign-in-suspended, or direct-login-disabled member mailbox remains discoverable but returns the corresponding mailbox_unavailable, mailbox_login_suspended, or direct_login_unavailable Send As reason. The member signs in with their own address and password; no shared or member password is returned.

SMTP does not save a Sent copy. Configure the client to append it to sent_copy.folder so replies and forwards remain visible to the team. Moving a message to folders.junk is supported, but does not promise spam-classifier training.

Treat receiving_only as incomplete. Configure or restore outgoing mail before telling a user to connect an app that checks both servers.

Treat unavailable as unusable: the mailbox lifecycle no longer permits direct authentication. Refresh mailbox state instead of offering its settings or an Apple Mail profile.

Generate an Apple Mail profile

GET /api/v1/mailboxes/{mailbox_id}/apple-mail-profile?lang=en
Authorization: Bearer tm_live_...
Accept: application/x-apple-aspen-config

The response is a .mobileconfig download. The profile contains the address and server settings, but never a password. TrekMail returns 409 mail_client_setup_not_ready if outgoing mail is not ready.

MCP tools

ToolWhat it returns
get_mail_client_setupPassword-free settings, current sending readiness, delegated shared-mailbox folders, and five localized guides.
get_apple_mail_profileA filename, media type, and base64-encoded Apple configuration profile.

Decode content_base64 into bytes and save it with the returned filename. Do not treat the profile itself as JSON or UTF-8 text.

Access and language

  • The REST endpoints require mailboxes:read and enforce domain and mailbox token constraints.
  • The hosted MCP tools require the OAuth scope mail:read.
  • The optional language value supports all 13 TrekMail interface languages. Without it, TrekMail checks Accept-Language and then uses the default locale.
  • Both MCP tools are read-only and do not need destructive-operation flags.

Common errors

not_foundThe mailbox does not exist or is outside the token constraints.
mailbox_unavailableThe mailbox is inactive.
direct_login_unavailableThe id belongs to a shared mailbox. Request setup for a regular member mailbox and inspect shared_mailboxes.items.
mailbox_login_suspendedSign-in is suspended for this mailbox. It still receives mail, but there are no client settings to hand out until sign-in is restored.
mail_client_setup_not_readyOutgoing mail is not ready for an Apple profile; inspect the returned reason.
forbiddenThe token or current plan does not permit mailbox read access.

For end-user flows, see Connect TrekMail to Any Email App and Use a Shared Mailbox in Your Mail App.

We use cookies for essential functionality. No ads, no ad tracking.

Sign in to TrekMail

Access your dashboard, mailboxes and DNS.

or

12+ characters, and not one from a known data breach.

or

Reset email sent

If an account exists for this email, we've sent password reset instructions.

By continuing, you agree to TrekMail's Terms and Privacy Policy.