Overview
Copies a message to a destination mailbox. Supports both same-account copy (using native IMAP COPY) and cross-account copy (using FETCH + APPEND). The original message remains in the source mailbox unchanged.Common use cases
- Archive messages to a different folder
- Copy messages between accounts
- Backup important messages
- Duplicate messages to multiple mailboxes
- Migrate messages across IMAP servers
Input parameters
Source account identifier. Must match pattern
^[A-Za-z0-9_-]{1,64}$.Message identifier in format
imap:{account_id}:{mailbox}:{uidvalidity}:{uid}.The account_id in the message_id must match the account_id parameter.Destination mailbox name (1-256 characters). Must not contain control characters.Common mailbox names:
INBOX- Main inboxSentorSent Items- Sent messagesArchive- Archived messagesTrashorDeleted Items- Deleted messages
imap_list_mailboxes to see available mailboxes.Destination account identifier. Defaults to the source
account_id (same-account copy).When copying to a different account:- The message is fetched from the source account
- The raw RFC822 message is appended to the destination account
- Both accounts must be configured in environment variables
Response
Human-readable one-line outcome:
"Message copied"Example request
Example response
Error responses
Implementation notes
Same-account copy
For copies within the same account, the server uses the native IMAPUID COPY command:
- Connect to the source account and authenticate (
steps_attempted=1) - Select the source mailbox in read-write mode and verify uidvalidity
- Execute
UID COPYcommand (steps_attempted=2)
Cross-account copy
For copies between different accounts, the server usesFETCH + APPEND:
- Connect to source account and authenticate (
steps_attempted=1) - Select source mailbox (read-only) and verify uidvalidity
- Fetch the raw RFC822 message from source (
steps_attempted=2) - Connect to destination account and authenticate (
steps_attempted=3) - Append the message to destination mailbox (
steps_attempted=4)
Step tracking
Thesteps_attempted and steps_succeeded fields help diagnose where failures occur:
- Same-account: 2 steps total (connect + copy)
- Cross-account: 4 steps total (connect source + fetch + connect destination + append)
steps_succeeded < steps_attempted, check the issues array to identify which stage failed.
Message ID availability
- Same-account copies may not return
new_message_idif the IMAP server doesn’t support theUIDPLUSextension - Cross-account copies using
APPENDtypically don’t returnnew_message_id - To find the copied message, search the destination mailbox using message headers or content
See also
- imap_move_message - Move message to different mailbox (removes from source)
- imap_list_mailboxes - List available mailboxes
- Write operations configuration - Enable write operations
- Multi-account setup - Configure multiple IMAP accounts