synchronize_account
Trigger an immediate sync of an IMAP or Exchange account with its server, pushing queued changes such as moves or status updates so other clients see them right away.
Instructions
Force Mail.app to synchronize an account (or every account) with its IMAP / Exchange server right now. Equivalent to clicking the refresh button next to the account or selecting Mailbox → Synchronize.
Use after move_email, update_email_status, or manage_trash
when downstream clients (iPhone, web mail, etc.) need to see the
change immediately. Mail.app's natural sync cadence is "automatic"
which can be several minutes — this collapses that to one IMAP push.
Implementation note:
Uses the synchronize with <account> AppleScript verb (per Mail.sdef:
"Command to trigger synchronizing of an IMAP account with the server")
rather than check for new mail. The latter is receive-only — it
pulls new messages but does NOT push pending IMAP commands like
queued moves / archives / flag changes. With check for new mail,
archives done via move_email could sit in Mail.app's local cache
for several minutes before reaching the IMAP server, leaving iPhone
Mail (which reads IMAP directly) showing already-archived messages
still in INBOX. synchronize with is the bidirectional verb that
drains pending IMAP commands AND fetches new mail.
Mail.app's synchronize is potentially long-running. We wrap each
invocation in with timeout of N seconds so the AppleScript returns
promptly. When the timeout fires (error -1712) Mail.app keeps the
sync running in the background — exactly the fire-and-forget
semantics callers expect.
Args: account: Account name (e.g., "Gmail", "Work"). Omit to sync every configured account.
Returns: Confirmation string with the account(s) synced or queued.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |