createMailRequest
- Print
- PDF
createMailRequest
- Print
- PDF
Article Summary
Share feedback
Thanks for sharing your feedback!
Sends emails.
This task is processed asynchronously, and when it is completed or an error occurs, then you will be notified via Notification at the upper right corner of the console.
POST https://{endpoint}/mails
Caution
- You can send an email to up to 100,000 recipients, and a normal email is sent to groups of 30 recipients at a time. (If [recipientGroupFilter] is specified, which is the condition for mailing to a recipient group combination, then you can send an email to more than 100,000 recipients.)
- You can specify up to 30 recipients for Cc and Bcc, respectively.
- The email body can't exceed 500 KB.
- The default sending limit is 1,000,000 per month. If you need more than the default sending limit, you can request a limit increase through Support.
- The sending request limit is calculated based on the number of email recipients, and the sending request for 100 recipients counts as 100 sending requests.
Request
Request parameters
Parameter name | Required status | Type | Restrictions | Description |
---|---|---|---|---|
senderAddress | Conditional | String | Required if templateSid is not passed. Some domains including naver.com and navercorp.com are not available. | Sender's email address. Any domain address can be used, but using the sender’s email account is recommended. Email accounts of portal sites, such as “id@naver.com,” to which DMARC is applied, may fail the DMARC checks and be filtered as spam according to the receiving party’s policies. |
senderName | No | String | Max:69 | Sender's name |
templateSid | No | Integer | Template ID | |
title | Conditional | String | Required if templateSid is not passed. Min: 0, Max: 500 | Email title |
body | Conditional | String | Required if templateSid is not passed. Max: 500 KB (Calculated by including unsubscription messages for ad emails.) | Email body |
individual | No | Boolean | Default:true | Individual shipments or general shipments * For individual shipments, only recipients (R) can be entered in the recipient list (recipients field) and will be sent separately if you set up multiple recipients. * Reference (C) and Bcc(B) are not available. |
confirmAndSend | No | Boolean | Indicates whether to send an email after checking it. | |
advertising | No | Boolean | Indicates whether it is a promotional email. | |
parameters | No | Object | Substitution parameter (which applies to all recipients). This is a Map type object, using the substitution ID as a key, and value mapping with the substitution ID as a value. | |
referencesHeader | No | String | Max: 100, and must be in the following form: <<unique_id@domain.com>> | This is a feature supported by the NAVER Mail service to view emails that have the same value in this field. |
reservationUtc | No | Long | Time scheduled to send messages, which is the natural number of milliseconds (in 1/1000 seconds) that have elapsed since January 1, 1970 00:00:00 UTC. It has priority over the reservationDateTime value. | |
reservationDateTime | No | String | 'yyyy-MM-dd HH:mm' UTC+09:00 | Time scheduled to send messages. The reservationUtc value has priority over this value. |
attachFileIds | No | List<String> | File IDs of the files uploaded with createFile API | List of attached file IDs |
recipients | Conditional | List<RecipientForRequest> | Required if recipientGroupFilter is not specified. | List of recipients |
recipientGroupFilter | No | RecipientGroupFilter | Condition for mailing to recipient group combination | |
useBasicUnsubscribeMsg | No | Boolean | Default:true, basic unsubscribe message size: about 900 bytes | Indicates whether to use default unsubscription message for ad emails. |
unsubscribeMessage | Conditional | String | Required if useBasicUnsubscribeMsg is False, 500 KB after adding up with Max:body | A customized unsubscription message or a message for unsubscription is added at the end of the body by default. If you add #{UNSUBSCRIBE_MESSAGE} to the desired location of the body, the unsubscription message will be shown at the tag's location. |
Response
HTTP status code | Description |
---|---|
201 | Request to send messages was successful. |
400 | Authentication failed, invalid request. |
500 | Server errors |
Example
Request example
curl -i -s -X POST \
-H "Content-Type:application/json" \
-H "x-ncp-apigw-timestamp:1521787414578" \
-H "x-ncp-iam-access-key:6uxz1nKkcYwUjWRG5Q1V7NsW0i5jErlu2NjBXXgy" \
-H "x-ncp-apigw-signature-v2:iJFK773KH0WwQ79PasqJ+ZGixtpDQ/abS57WGQdld2M=" \
"https://mail.apigw.ntruss.com/api/v1/mails"\
-d ''{"senderAddress":"no_reply@company.com","title":"Hello, ${customer_name}. ","body":"Your grade has been changed from ${BEFORE_GRADE} to ${AFTER_GRADE}.","recipients":[{"address":"hongildong@naver_.com","name":"Gildong Hong","type":"R","parameters":{"customer_name":"Gildong Hong","BEFORE_GRADE":"SILVER","AFTER_GRADE":"GOLD"}},{"address":"chulsoo@daum_.net","name":null,"type":"R","parameters":{"customer_name":"Cheolsu","BEFORE_GRADE":"BRONZE","AFTER_GRADE":"SILVER"}}],"individual":true,"advertising":false}''
Request example (using a template)
curl -i -s -X POST \
-H "Content-Type:application/json" \
-H "x-ncp-apigw-timestamp:1521787414578" \
-H "x-ncp-iam-access-key:6uxz1nKkcYwUjWRG5Q1V7NsW0i5jErlu2NjBXXgy" \
-H "x-ncp-apigw-signature-v2:iJFK773KH0WwQ79PasqJ+ZGixtpDQ/abS57WGQdld2M=" \
"https://mail.apigw.ntruss.com/api/v1/mails"\
-d ''{"templateSid" : 1,"recipients":[{"address":"hongildong@naver_.com","name":"Gildong Hong","type":"R","parameters":{"customer_name":"Gildong Hong","BEFORE_GRADE":"SILVER","AFTER_GRADE":"GOLD"}},{"address":"chulsoo@daum_.net","name":null,"type":"R","parameters":{"customer_name":"Cheolsu","BEFORE_GRADE":"BRONZE","AFTER_GRADE":"SILVER"}}],"individual":true,"advertising":false}''
Response example
{
"requestId":"20181203000000000201",
"count":10000
}
Property
Category | Required status | Type | Restrictions | Description |
---|---|---|---|---|
requestId | Yes | String | Request ID to send an email (for identifying each request). If you make a request to send multiple messages at the same time, then the requestId can contain multiple mailIds. | |
count | Yes | Integer | Number of mailing requests |
Error codes
HTTP Status Code | Return code | Response message |
---|---|---|
400 | 77101 | Error in login information |
400 | 77102 | BAD_REQUEST |
400 | 77103 | Resource not found |
403 | 77201 | No permission |
403 | 77202 | No request to subscribe the email product |
405 | 77001 | METHOD_NOT_ALLOWED |
415 | 77002 | UNSUPPORTED_MEDIA_TYPE |
500 | 77301 | Default project not found |
500 | 77302 | Error in working with external system API |
500 | 77303 | Other INTERNAL_SERVER_ERROR |
Was this article helpful?