Send a message

PUT /api/2.0/mail/messages/send

Request

Sends a message with the ID specified in the request.

Authorization

An API key is a token that you provide when making API calls. Include the token in a header parameter called Authorization.

Example: Authorization: 864FE52C-1C1C-469F-9308-51DAFEFE7436.

Headers

Acceptenum of string

Can be one of: application/json.

Content-Typeenum of string

Can be one of: application/json.

Body

idinteger

Message ID which will be sent or 0

fromstring

Mail address from which a letter will be sent. Format: Name <name@domain>

toarray of string

List of mail addresses to which a letter will be sent. Format: Name <name@domain>

ccarray of string

List of Cc (carbon copy) mail addresses. Format: Name <name@domain>

bccarray of string

List of Bcc (blind carbon copy) mail addresses. Format: Name <name@domain>

mimeReplyToIdstring

Message ID to which this message is replying to

importanceboolean

Specifies if this message is important or not: true - important, false - not important

subjectstring

Message subject

tagsarray of integer

List of tag IDs added to the message

bodystring

Message body as the HTML string

attachmentsarray of object

List of message attachments

fileIdintegerformat: int32
fileNamestring
sizeintegerformat: int64
contentTypestring
needSaveToTempboolean
contentIdstring
fileNumberintegerformat: int32
storedNamestring
streamIdstring
attachedAsLinkboolean
tempStoredUrlstring
fileLinksShareModeinteger

Sharing mode for the links of the attached files

calendarIcsstring

Calendar event in the iCal format for sending

isAutoreplyboolean

Specifies if this message is autoreply or not

requestReceiptboolean

Specifies whether to add a request with the Return-Receipt-To header or not

requestReadboolean

Specifies whether to add a request with the Disposition-Notification-To header or not

Examples

PUT /api/2.0/mail/messages/send HTTP/1.1
Accept: application/json
Content-Length: 423
Content-Type: application/json
Host: example.com

{
  "attachments": [
    {
      "value": {
        "fileId": "1234",
        "fileName": "fileName",
        "size": "1234",
        "contentType": "contentType",
        "needSaveToTemp": "true",
        "contentId": "contentId",
        "fileNumber": "333",
        "storedName": "storedName",
        "streamId": "streamId",
        "attachedAsLink": "true",
        "tempStoredUrl": "tempStoredUrl"
      }
    }
  ]
}
curl --request PUT \
  --url https://example.com/api/2.0/mail/messages/send \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "attachments": [
    {
      "value": {
        "fileId": "1234",
        "fileName": "fileName",
        "size": "1234",
        "contentType": "contentType",
        "needSaveToTemp": "true",
        "contentId": "contentId",
        "fileNumber": "333",
        "storedName": "storedName",
        "streamId": "streamId",
        "attachedAsLink": "true",
        "tempStoredUrl": "tempStoredUrl"
      }
    }
  ]
}'

Responses

200

Message ID

401

Unauthorized

Get Help

  • If you have any questions about ONLYOFFICE Workspace, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).