Mailbox API – Mails Create and Send

APIs & Tools

The Mailbox API is available starting with Axigen X4 (10.4).

Create

This endpoint allows you to create a new draft email or insert an email into an existing folder.

If folderId is specified, the email will be appended to the specified folder, otherwise it will be created as a draft, in the Drafts folder.

Request body (JSON)

Name

Type

Required

Values

Description

folderId

String

The default value is the ID of the “Drafts” folder

from

String

The desired value of the from header

to

String

The desired value of the to header

cc

String

The desired value of the cc header

bcc

String

The desired value of the bcc header

replyTo

String

The desired value of the Reply-To header

refwType

String

"re", "fw"

Whether the mail is a reply or a forward.

The mail cannot be both a reply and a forward (“refw” is an invalid value)

refwMailId

String

Required if refw is set

This field is dependent on refwType:

  • refwType missing: refwMailId should not be sent

  • refwType set to "re": refwMailId required, the ID of the mail being replied to. This ID is used to automatically generate the References and In-Reply-To headers for replies.

  • refwType set to "fw": refwMailId required, the ID of the mail being forwarded

subject

String

The desired value of the Subject header

isUnread

Boolean

The unread / read value

isFlagged

Boolean

The flagged / not flagged value

importance

String

"normal", "low", "high"

The desired importance. If missing, the importance will default to "normal".

bodyText

String

The UTF-8 text body, if existing

bodyHtml

String

The UTF-8 HTML body, if existing

temporaryAttachments

Array

JSON object list in the following format:

The attachments in the attachments queue.

Response

If successful, the response will contain an instance of mail.

Send

This endpoint allows you to send an email which is not yet saved to Drafts.

It will also save a copy to Sent according to the user preference.

Request body (JSON)

Name

Type

Required

Values

Description

from

String

The desired value of the from header

to

String

The desired value of the to header

cc

String

The desired value of the cc header

bcc

String

The desired value of the bcc header

replyTo

String

The desired value of the Reply-To header

refwType

String

"re", "fw"

Whether the mail is a reply or a forward.

The mail cannot be both a reply and a forward (“refw” is an invalid value)

refwMailId

String

Required if refw is set

This field is dependent on refwType:

  • refwType missing: refwMailId should not be sent

  • refwType set to "re": refwMailId required, the ID of the mail being replied to. This ID is used to automatically generate the References and In-Reply-To headers for replies.

  • refwType set to "fw": refwMailId required, the ID of the mail being forwarded

subject

String

The desired value of the Subject header

importance

String

"normal", "low", "high"

The desired importance. If missing, the importance will default to "normal".

requestReadReceipt

Boolean

Whether to request a read receipt

requestDeliveryReceipt

Boolean

Whether to request a delivery receipt

bodyText

String

The UTF-8 text body, if existing

bodyHtml

String

The UTF-8 HTML body, if existing

temporaryAttachments

Array

JSON object list in the following format:

The attachments in the attachments queue.

Response

If successful, the response will be empty.

Replace Draft

This endpoint allows you to replace an existing draft email.

URL parameters

Name

Type

Required

Values

Description

mailId

String

*

The draft mail ID

Request body (JSON)

Name

Type

Required

Values

Description

from

String

The desired value of the from header

to

String

The desired value of the to header

cc

String

The desired value of the cc header

bcc

String

The desired value of the bcc header

replyTo

String

The desired value of the Reply-To header

refwType

String

"re", "fw"

Whether the mail is a reply or a forward.

The mail cannot be both a reply and a forward (“refw” is an invalid value)

refwMailId

String

Required if refw is set

This field is dependent on refw:

  • refwType missing: refwMailId should not be sent

  • refwType set to "re": refwMailId required, the ID of the mail being replied to. This ID is used to automatically generate the References and In-Reply-To headers for replies.

  • refwType set to "fw": refwMailId required, the ID of the mail being forwarded

subject

String

The desired value of the Subject header

isUnread

Boolean

The unread / read value

isFlagged

Boolean

The flagged / not flagged value

importance

String

"normal", "low", "high"

The desired importance. If missing, the importance will default to "normal".

bodyText

String

The UTF-8 text body, if existing

bodyHtml

String

The UTF-8 HTML body, if existing

temporaryAttachments

Array

JSON object list in the following format:

The attachments in the attachments queue.

Response

If successful, the response will contain an instance of mail.

Send Draft

This endpoint allows you to send an existing draft email.

If this is preceded by opening the draft for editing, on send you should first save it to drafts and then call this endpoint with the draft mail ID.

This endpoint will also delete the draft upon sending and will save a copy to Sent according to the user preference.

URL parameters

Name

Type

Required

Values

Description

mailId

String

*

The draft mail ID

Response

If successful, the response will be empty.

Temporary Attachments

Axigen uses an attachments queue for attachment uploads.

1. To attach a file to a message as a regular attachment:

a. Use the “Create” endpoint to upload the file
b. Pass the temporaryAttachments array to the “Send” or “Save” endpoint.

2. To attach a file to a message as an inline attachment:

a. Use the “Create” endpoint to upload the file
b. Generate a unique contentId and refer it as a cid source for the corresponding inline image in your email body.
This will ensure that your mail body will contain a valid reference for each inline attachment.
c. Pass the temporaryAttachments array (including the contentId and the isInline property set to true) to the “Send” or “Save” endpoint.

3. When forwarding an email or opening a draft for editing:

a. Add the existing attachments to the internal queue by calling the “Store” endpoint
b. Update your email body and attachments list to point to the internal queue attachments instead of the original ones (both inline and regular attachments).

Create

Request body

Include the attachment as a multipart/form-data HTTP body part.

Response

Get

URL parameters

Name

Type

Required

Values

Description

temporaryAttachmentId

String

*

The temporary attachment ID

Response

The temporary attachment.

Delete

URL parameters

Name

Type

Required

Values

Description

temporaryAttachmentId

String

*

The temporary attachment ID

Response

If successful, the response will be empty.

Store in Queue

This endpoint allows you to store an email’s attachments in the internal queue.

Request body (JSON)

Name

Type

Required

Values

Description

mailId

String

*

The mail ID whose attachments you want to store.

Response

The IDs of the temporary attachments are not related to the original mail; they are internal queue unique identifiers.