Fluxmail

Sending and retries

Send or schedule messages and saved drafts, and check uncertain outcomes without duplicating mail.

Sending requires mail.send and access to the selected mailbox. Give your agent an explicit instruction to send; onboarding checks should only verify the connection.

Every send_email and forward_email call needs an idempotencyKey. Generate a unique key for the intended send and save it with the request before submitting. If the response is lost, that key lets you look up what happened.

Send a message

Pass a body like this to the MCP send_email tool or POST /api/mail/send_email. Replace the example mailbox, recipient, and key with values for your intended message:

{
  "accountId": "MAILBOX_ID",
  "idempotencyKey": "UNIQUE_KEY_FOR_THIS_SEND",
  "to": ["recipient@example.com"],
  "subject": "Meeting notes",
  "bodyText": "Here are the notes we discussed."
}

The key must contain 1 to 255 printable ASCII characters without spaces. A UUID works. Save the exact arguments alongside it.

Message fields and attachment formats are listed in the REST reference. To validate recipients, the sender, and attachment sizes before sending, call preview_send with the message fields and a connection with mail.send. Omit idempotencyKey from the preview. To check a saved draft, pass its draftId instead of message fields. That also needs mail.drafts.

Send a saved draft

Use the draft's ID instead of message fields:

{
  "accountId": "MAILBOX_ID",
  "idempotencyKey": "UNIQUE_KEY_FOR_THIS_SEND",
  "draftId": "DRAFT_ID"
}

Supply either draftId or message fields in a send request. Submitting a saved draft needs mail.send and mail.drafts; reading a draft with get_draft needs mail.drafts.

Forward a message

Pass the message ID to the MCP forward_email tool or POST /api/mail/forward_email:

{
  "accountId": "MAILBOX_ID",
  "idempotencyKey": "UNIQUE_KEY_FOR_THIS_FORWARD",
  "messageId": "MESSAGE_ID",
  "to": ["recipient@example.com"],
  "comment": "Forwarding the signed contract."
}

Cloud reads the original, so forwarding needs mail.read as well as mail.send. The new message has a Fwd: subject, your optional comment, and the original's sender, date, subject, recipients, and body quoted below it. The original attachments are included and must fit the Cloud attachment limit. Set includeAttachments to false to leave them out. You can also add cc and bcc recipients and choose a from address returned by list_send_as.

A forward uses the same idempotency keys and send statuses as send_email.

Schedule a send

Add sendAt to a send_email or forward_email request to send the message later. Use an ISO 8601 time with a time zone offset or Z, up to a year ahead and before the connection expires:

{
  "accountId": "MAILBOX_ID",
  "idempotencyKey": "UNIQUE_KEY_FOR_THIS_SEND",
  "to": ["recipient@example.com"],
  "subject": "Meeting notes",
  "bodyText": "Here are the notes we discussed.",
  "sendAt": "2026-12-01T09:00:00-05:00"
}

Cloud saves the message as a draft in the mailbox right away and sends that draft at the scheduled time, usually within a minute of it. A scheduled forward saves the forwarded message, with its attachments, as the draft. Cloud keeps only the time, mailbox and draft ID; the message stays in your mailbox. The response has a kind of scheduled, a status of queued and a scheduleId.

The message goes out as the connection that scheduled it, so Cloud refuses a time after that connection expires. An agent's approval expires after at most 90 days, and an agent key on the date you chose. If that connection has been revoked, has lost mail.send or can no longer use the mailbox by then, or the plan has ended, Cloud doesn't send the message and marks the schedule as failed. The same happens when the draft was deleted or sent from somewhere else first. When the mail provider is unavailable, or the workspace has reached its hourly send limit, Cloud tries again for up to a day. The send counts toward that limit when it goes out.

list_scheduled_emails needs mail.read. It lists pending sends first, then the 100 most recent finished ones, each with a status of pending, sending, sent, failed, uncertain or canceled. lastError explains a failure. Finished sends stay in the list for 30 days.

To stop a pending send, call cancel_scheduled_email with its scheduleId. Canceling needs mail.drafts and keeps the draft in the mailbox. A send that has already started can't be canceled.

You can have up to 500 scheduled sends waiting at a time.

Send status and duplicate protection

A successful send returns its delivery operation: an operationId equal to your idempotency key, the accountId, a kind of send or forward, a status of succeeded, and the provider's result. REST wraps these fields in data; MCP puts them in structuredContent.data.

Over MCP, a send that fails after Cloud records the key also returns its delivery operation, with a status of failed or uncertain and the error code in error.code. The tool result is marked as an error. Over REST, these failures return an HTTP error.

Reusing the same key with identical arguments retrieves the saved successful result. Changing the arguments under that key returns idempotency_conflict.

After a timeout or uncertain failure, call get_delivery_operation through MCP or POST /api/mail/get_delivery_operation:

{
  "accountId": "MAILBOX_ID",
  "operationId": "THE_ORIGINAL_IDEMPOTENCY_KEY"
}

Use the returned status to decide what to do next:

StatusNext step
succeededThe provider accepted the send. The saved result is available in result. This does not prove recipient delivery.
uncertainSubmission may have happened. Inspect Sent mail and delivery evidence before deciding whether another send is appropriate. Cloud blocks resubmission under this key.
failedThe message was not sent. Correct the error and use a new key for a new attempt.
queuedThe message is scheduled and hasn't been sent yet.
canceledThe scheduled send was canceled. Its draft is still in the mailbox.

Cloud does not automatically retry uncertain sends. A missing send record is not proof that retrying with a new key is safe. Follow the saved send status even when an HTTP error suggests a temporary failure.

Disconnecting a mailbox deletes its send-operation records. Check uncertain sends before disconnecting; reconnecting won't restore duplicate-send protection for those records.

Last updated