POST/users/{userId}/mail

Sends a message.

Note

  • An email subject can be up to 180 characters in length; if it is longer than that, the excess characters are ignored.
  • Before sending a message, the API operation only checks whether the To address is correctly formed; it does not check whether the address is valid (whether it can receive a message, whether it exists, etc.).
  • If the address is not valid, "[Message delivery failed]" message is sent to the sender.
  • A file of up to 20 MB can be attached. The maximum size of an attachment can be set by the administrator.
  • How to attach an inline image
  • Add the following tag with "cid: a unique text string" at the location in the message body where the inline image should appear.
    • <img src="cid:reddotiVBORw0KGgoAAAA" alt=\"Red dot\" />
  • Base64-encode and add "inline=true, cid=reddotiVBORw0KGgoAAAA" (cid: a unique text string added to the body) and "data= image to attach" to the attachment.

Authorization

oauth2

OAuth 2.0 authentication.
For more information, see Authentication and Authorization.

Scope

mail

HTTP Request

POSThttps://www.worksapis.com/v1.0/users/{userId}/mail

Path Parameters

ParameterTypeDescription
userId string 

Member ID (must be URL-encoded)

  • User ID
  • Login ID (email)
  • Me

required
example : me 

Header Parameters

HeadertypeDescription
Authorization string 

Bearer {token}


required 
Content-Type string 

application/json


required
example : application/json 

Request Body

PropertyTypeDescription
to string 

Email addresses of to-recipients. Use ';' to add multiple addresses.


required
minLength : 1
example : admin@example.com; admin1@example.com 
cc string 

Email addresses of cc-recipients. Use ';' to add multiple addresses.


example : admin@example.com; admin1@example.com 
bcc string 

Email addresses of bcc-recipients. Use ';' to add multiple addresses.


example : admin@example.com; admin1@example.com 
subject string 

Subject
A subject can be up to 180 characters in length; if it is longer than that, the excess characters are ignored.


required
minLength : 1 
body string 

Body


minLength : 0 
contentType string 

Body format

  • html (default)
  • text (text message)

default : html
minLength : 1
Allowed values : html, text 
userName string 

Sender name


minLength : 1 
isSaveSentMail boolean 

Indicates whether to save the message in Sent.

  • true (default)
  • false

default : true 
isSaveTracking boolean 

Indicates whether to save the message in Tracking.

  • true (default)
  • false

default : true 
isSendSeparately boolean 

Indicates whether to send an individual message to each recipient.

  • true
  • false (default)

default : false 
securityLevel string 

Security level of the message

  • General: General
  • Restricted: Restricted
  • Confidential: Confidential
  • Non-business: Non-business

default : General
Allowed values : General, Restricted, Confidential, Non-business 
attachments array (object) 

Attachment information


minItems : 0 

object

PropertyTypeDescription
data string 

Attached file data (encoded with Base64)


minLength : 1 
filename string 

File name


minLength : 1
maxLength : 250 
fileType string 

File content type


minLength : 1 
cid string 

Content-ID (must be added when attaching an inline image)

 
inline boolean 

Indicates whether it is an inline image.


default : false 

Request Example

example

1{2  "to": "admin@example.com",3  "subject": "Test",4  "body": "Body",5  "contentType": "html",6  "userName": "admin",7  "isSaveSentMail": true,8  "isSaveTracking": true,9  "isSendSeparately": false,10  "attachments": [11    {12      "filename": "index.html",13      "fileType": "text/html",14      "data": "PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImphIj4KPGhlYWQ+Cjx0aXRsZT5XZWxjb21lIHRvIFdPUktTIEFQSTwvdGl0bGU+CjwvaGVhZD4K PGJvZHk+CjxoMT5XZWxjb21lIFRvIFdPUktTIEFQSTwvaDE+CldlbGNvbWUgdG8gdGhlIFdPUktTIEFQSSB3b3JsZC4KPC9ib2R5Pgo8L2h0bWw+"15    }16  ]17}

Response

HTTP 202

Accepted

HTTP 400

Bad Request

HTTP 403

Forbidden

HTTP 500

Internal Server Error