createMailRequest
    • PDF

    createMailRequest

    • PDF

    Article Summary

    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 nameRequired statusTypeRestrictionsDescription
    senderAddressConditionalStringRequired 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.
    senderNameNoStringMax:69Sender's name
    templateSidNoIntegerTemplate ID
    titleConditionalStringRequired if templateSid is not passed. Min: 0, Max: 500Email title
    bodyConditionalStringRequired if templateSid is not passed. Max: 500 KB (Calculated by including unsubscription messages for ad emails.)Email body
    individualNoBooleanDefault:trueIndividual 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.
    confirmAndSendNoBooleanIndicates whether to send an email after checking it.
    advertisingNoBooleanIndicates whether it is a promotional email.
    parametersNoObjectSubstitution 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.
    referencesHeaderNoStringMax: 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.
    reservationUtcNoLongTime 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.
    reservationDateTimeNoString'yyyy-MM-dd HH:mm' UTC+09:00Time scheduled to send messages. The reservationUtc value has priority over this value.
    attachFileIdsNoList<String>File IDs of the files uploaded with createFile APIList of attached file IDs
    recipientsConditionalList<RecipientForRequest>Required if recipientGroupFilter is not specified.List of recipients
    recipientGroupFilterNoRecipientGroupFilterCondition for mailing to recipient group combination
    useBasicUnsubscribeMsgNoBooleanDefault:true, basic unsubscribe message size: about 900 bytesIndicates whether to use default unsubscription message for ad emails.
    unsubscribeMessageConditionalStringRequired if useBasicUnsubscribeMsg is False, 500 KB after adding up with Max:bodyA 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 codeDescription
    201Request to send messages was successful.
    400Authentication failed, invalid request.
    500Server 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

    CategoryRequired statusTypeRestrictionsDescription
    requestIdYesStringRequest 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.
    countYesIntegerNumber of mailing requests

    Error codes

    HTTP Status CodeReturn codeResponse message
    40077101Error in login information
    40077102BAD_REQUEST
    40077103Resource not found
    40377201No permission
    40377202No request to subscribe the email product
    40577001METHOD_NOT_ALLOWED
    41577002UNSUPPORTED_MEDIA_TYPE
    50077301Default project not found
    50077302Error in working with external system API
    50077303Other INTERNAL_SERVER_ERROR

    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.