Submit

Submit a stored draft for delivery

Sends an existing draft message. The message must be a draft: stored in the Drafts folder or flagged as a draft (IMAP), carrying the DRAFT label (Gmail), or a draft message (MS Graph). Gmail and MS Graph accounts use the native draft-send call of the provider, which also files the message into the Sent Mail folder and removes the draft. For IMAP accounts the draft is downloaded, sent over SMTP, copied to the Sent Mail folder (unless disabled), and then removed from the Drafts folder.<br/><br/>Delivery is asynchronous. A 2xx means the message was queued, not that it was sent. Failed attempts are retried with exponential backoff up to the configured deliveryAttempts; follow the outcome through the Outbox endpoints or the messageSent, messageDeliveryError and messageFailed webhooks.<br/><br/>For SMTP accounts EmailEngine uploads the sent message to the Sent Mail folder after delivery. Gmail API and MS Graph accounts file sent messages themselves, so no upload is performed.

post/v1/account/{account}/message/{message}/submit

Request

  • Base URL: https://your-emailengine-host
  • URL: https://your-emailengine-host/v1/account/{account}/message/{message}/submit
  • Auth: HTTP bearer

Path parameters

accountstring required

Unique identifier for the email account

Example:user123
messagestring required

Message ID of the draft

Example:AAAAAQAACnA

Headers

x-ee-timeoutinteger

Request timeout in milliseconds. Raises the command timeout above the EENGINE_TIMEOUT default for a long-running request; a value below the default has no effect

Example:30000
idempotency-keystring

Unique key to prevent duplicate processing of the same request

Example:submit-12345

Request body

copyboolean nullable

If set then either copies the message to the Sent Mail folder or not. If not set then uses the account's default setting

sentMailPathstring

Upload sent message to this folder. By default the account's Sent Mail folder is used. Only applies to SMTP deliveries.

sendAtstring date-time

Send message at specified time

deliveryAttemptsinteger

How many delivery attempts to make until message is considered as failed

gatewaystring

Optional SMTP gateway ID for message routing

proxystring

Optional proxy URL to use when connecting to the SMTP server. A token with restricted permissions can not set this - it redirects a session that carries the account credentials

localAddressstring

Optional local IP address to bind to when connecting to the SMTP server

Example request

{
  "envelope": {
    "from": "sender@example.com",
    "to": [
      "recipient@example.com"
    ]
  },
  "sentMailPath": "Sent Mail",
  "sendAt": "2021-07-08T07:06:34.336Z",
  "deliveryAttempts": 10,
  "gateway": "example",
  "dsn": {
    "id": "order-4815-notify",
    "notify": [
      "failure",
      "delay"
    ],
    "recipient": "bounces@example.com"
  },
  "proxy": "socks5://proxy.example.com:1080",
  "localAddress": "127.0.0.1"
}

Response

Returns the queue ID the stored draft was accepted under. Delivery happens asynchronously - a 200 means queued, not sent.

responsestring
messageIdstring

Message-ID header value

queueIdstring

Queue identifier for scheduled email

sendAtstring date-time

Scheduled send time

Example response

{
  "response": "Queued for delivery",
  "messageId": "<a2184d08-a470-fec6-a493-fa211a3756e9@example.com>",
  "queueId": "d41f0423195f271f",
  "sendAt": "2021-07-08T07:06:34.336Z",
  "idempotency": {
    "key": "submit-12345",
    "status": "MISS"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.