Message

Upload message

Upload a message structure, compile it into an EML file and store it into selected mailbox.<br/><br/>For MS Graph accounts only drafts can be uploaded, and the draft flag cannot be changed afterwards.<br/><br/>For Gmail API accounts the flags and internalDate fields are ignored. The message is inserted with the target label only, and its internal date is taken from the Date header of the message itself.

post/v1/account/{account}/message

Request

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

Path parameters

accountstring required

Unique identifier for the email account

Example:user123

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

Request body

pathstring required

Target mailbox folder path

flagsstring[]

Message flags

internalDatestring date-time

Sets the internal date for this message

rawstring

A Base64-encoded email message in RFC 822 format

subjectstring

Message subject

textstring

Message Text

htmlstring

Message HTML

messageIdstring

Message ID

headersCustomHeaders

Custom Headers

localestring

Optional locale

tzstring

Optional timezone

Example request

{
  "path": "INBOX",
  "flags": [
    "\\Seen",
    "\\Draft"
  ],
  "internalDate": "2021-07-08T07:06:34.336Z",
  "reference": {
    "message": "AAAAAQAACnA",
    "action": "reply",
    "messageId": "<test123@example.com>",
    "threadId": "1694936993596975454"
  },
  "raw": "TUlNRS1WZXJzaW9uOiAxLjANClN1YmplY3Q6IGhlbGxvIHdvcmxkDQoNCkhlbGxvIQ0K",
  "from": {
    "name": "From Me",
    "address": "sender@example.com"
  },
  "to": [
    {
      "address": "recipient@example.com"
    }
  ],
  "cc": [
    {
      "name": "Some Name",
      "address": "user@example.com"
    }
  ],
  "bcc": [
    {
      "name": "Some Name",
      "address": "user@example.com"
    }
  ],
  "subject": "What a wonderful message",
  "text": "Hello from myself!",
  "html": "<p>Hello from myself!</p>",
  "attachments": [
    {
      "filename": "transparent.gif",
      "contentType": "image/gif",
      "cid": "unique-image-id@localhost",
      "reference": "AAAAAQAACnAcde",
      "content": "R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs="
    }
  ],
  "messageId": "<test123@example.com>",
  "headers": {
    "X-My-Custom-Header": "Custom header value"
  },
  "locale": "fr",
  "tz": "Europe/Tallinn"
}

Response

Returns the uploaded message with the identifiers the provider assigned to it.

idstring

Unique identifier for the message. NB! This and other fields might not be present if server did not provide enough information

pathstring

Folder this message was uploaded to

uidinteger

UID of uploaded message (IMAP accounts only)

uidValiditystring

UIDVALIDITY of the target folder. Numeric value cast as string. IMAP accounts only.

seqinteger

Sequence number of uploaded message (IMAP accounts only)

messageIdstring

Message ID

Example response

{
  "id": "AAAAAgAACrI",
  "path": "INBOX",
  "uid": 12345,
  "uidValidity": "12345",
  "seq": 12345,
  "messageId": "<test123@example.com>",
  "reference": {
    "message": "AAAAAQAACnA",
    "threadId": "1694936993596975454",
    "success": true,
    "error": "Referenced message was not found"
  }
}

Changes

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