Available in Classic and VPC
Request an email to be sent, specifying the recipient, sender, mail content, etc. The mailing operation is processed asynchronously.- You can send up to 100,000 recipients at a time, and it is processed in batches of 30 by default. However, you can send more than 100,000 recipients when you enter the recipient group combination sending condition (
recipientGroupFilter). - You can specify up to 30 recipients for Cc and Bcc.
- Email bodies are allowed to be up to 500 KB.
- The default sending limit is 1,000,000 per month, but you can request an increase through Support.
- The sending request limit is calculated based on the number of email recipients. A send request for 100 recipients is considered 100 send requests.
Request
The following describes the request format for the endpoint. The request format is as follows:
| Method | URI |
|---|---|
| POST | /mails |
Request headers
For information about the headers common to all Cloud Outbound Mailer APIs, see Cloud Outbound Mailer request headers를 참조해 주십시오.
#요청헤더).
Request body
The following describes the request body.
| Field | Type | Required | Description |
|---|---|---|---|
senderAddress |
String | Conditional | Sender's email address
|
senderName |
String | Optional | Sender's name (byte)
|
templateSid |
Integer | Optional | SID of the template you want to use to create the email |
title |
String | Conditional | Email subject (byte)
|
body |
String | Conditional | Email body (KB)
|
individual |
Boolean | Optional | Whether to send generally or by individual
|
confirmAndSend |
Boolean | Optional | Whether to send after confirmation
|
advertising |
Boolean | Optional | Whether it is advertising email
|
parameters |
Object | Optional | Substitution parameter
|
referencesHeader |
String | Optional | References header
|
reservationUtc |
Long | Optional | Reserved delivery date and time
|
reservationDateTime |
String | Optional | Reserved delivery date and time (yyyy-MM-dd HH:mm)
|
attachFileIds |
List[String] | Optional | ID list of attachments
|
recipients |
List | Conditional | Recipient list
|
recipientGroupFilter |
Object | Optional | Recipient group combination filter |
useBasicUnsubscribeMsg |
Boolean | Optional | Whether to use unsubscribe messages in advertising email
|
unsubscribeMessage |
String | Conditional | Custom unsubscribe message text
|
Request example
The following is a sample request.
Create without template
The following is a sample request for writing your own email content without using a template.
curl --location --request POST 'https://mail.apigw.ntruss.com/api/v1/mails' \
--header 'x-ncp-apigw-timestamp: {Timestamp}' \
--header 'x-ncp-iam-access-key: {Access Key}' \
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}' \
--header 'Content-Type: application/json' \
--data-raw '{"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":"Chulsoo","BEFORE_GRADE":"BRONZE","AFTER_GRADE":"SILVER"}}],"individual":true,"advertising":false}'
Create with template
The following is a sample request for writing your own email content using a template.
curl --location --request POST 'https://mail.apigw.ntruss.com/api/v1/mails' \
--header 'x-ncp-apigw-timestamp: {Timestamp}' \
--header 'x-ncp-iam-access-key: {Access Key}' \
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}' \
--header 'Content-Type: application/json' \
--data-raw '{"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":"Chulsoo","BEFORE_GRADE":"BRONZE","AFTER_GRADE":"SILVER"}}],"individual":true,"advertising":false}'
Response
The following describes the response format.
Response body
The following describes the response body.
| Field | Type | Required | Description |
|---|---|---|---|
requestId |
String | - | Email delivery request ID to distinguish each request
|
count |
Integer | - | Number of mailing requests |
Response status codes
For information about the HTTP status codes common to all Cloud Outbound Mailer APIs, see Cloud Outbound Mailer response status codes.
Response example
The following is a sample response.
{
"requestId":"20181203000000000201",
"count":10000
}