edit-icon download-icon

Set up asynchronous notifications

Last Updated: Jan 25, 2018

After you send an email request to the DirectMail server, the delivery results is returned to you synchronously. The delivery results are stored in the Message Service receiving terminals (HTTP, message queue, subject) following the event notification rules that you have created in Message Service. You can get the delivery results asynchronously using the Message Service receiving terminals.
To set up asynchronous notifications, first activate Message Service.Message Service may incur additional fees.

Create event notification rules

We recommend that you create a message receiving queue first before you create a notification rule to function as the message receiving terminal.

Create a message receiving queue

  1. Log on to the Message Service console.
  2. On the left-side navigation pane, click Queues.
  3. At the upper-right corner, click Create Queue. A dialog box appears.
  4. Enter the queue name, select a region (a region in the closest geographic proximity is recommended), use the default values for other fields, and click OK.


Create an event notification rule

  1. On the left-side navigation pane on the Message Service console, click Event Notification.
  2. Select the region and product name.
  3. At the upper-right corner, click Create Rule.
  4. Check the region and product name, enter the rule name, select the event type, add the receiving terminal, and click OK.
    Currently, the system supports three types of receiving terminals (HTTP, queue, and subject). For this configuration, select the previously created message receiving queue as the receiving terminal.

create rule

new rule

Note: Generally it takes up to 10 minutes for the newly created rule to take effect.

Create asynchronous notifications

Asynchronous notifications can be divided into asynchronous notifications at the account level and at the sender address level.
If you want to implement asynchronous notifications about delivery results for all sender addresses, you can set the account-level asynchronous notifications.
If you want to implement asynchronous notifications about delivery results for specific sender addresses, you must set the email address-level asynchronous notifications for the specific sender addresses.
You can also set both. The email address-level asynchronous notifications have a higher priority level than the account-level ones. The specified sender addresses get the email address-level asynchronous notifications, while all other sender addresses get the account-level asynchronous notifications. This allows you to send notifications for specific accounts to different message receiving terminals.

Create an account-level asynchronous notification.

  1. Log on to DirectMail console.
  2. On the left-side navigation pane, click Asynchronous Notifications.
  3. At the upper-right corner, click New Account-level Asynchronous Notifications.
  4. Select the region and click OK.

asynchronous notification

create notification

Create an email address-level asynchronous notification.

  1. Click Email Address-level Asynchronous Notification on the Asynchronous Notifications page.
  2. At the upper right corner of the page, click New Address-level Asynchronous Notifications.
  3. Select the sender address and region, and click OK.

Address-level notifications

Create address-level notification

Receive messages in the queue

After sending an email request through the DirectMail server, you can view the notifications pushed to the queue on the Message Service console.

  1. Log on to the Message Service console.
  2. On the left-side navigation pane, click Queues.
  3. Select the region to view the active messages in the queue created for DirectMail messages.
  4. Click Receive Message to view the specific event notifications pushed to the queue.

View messages

Descriptions of the message content is as the following:

env_id=12769055421&msg_id=37483d95-7a08-41fb-9738-3d3ffa24d415@alibaba.com&account=dmxxx@xxxtest.com&from=dmxxx@xxxtest.com&rcpt=dmyyy@xyztest.com&recv_time=2017-03-29 14:22:40&end_time=2017-03-29 14:22:43&status=0&event=deliver®ion=cn-hangzhou&err_code=250&err_msg=250 Send Mail OK

env_id=12625010655&msg_id=ac349efc-0d79-489b-affa-f178dce3e49e@alibaba.com&account=ere@zzztest.site&from=ere@zzztest.site&rcpt=dmtest@xyztest.com&recv_time=2017-03-28 19:09:49&end_time=2017-03-28 19:09:51&status=4&event=deliver®ion=cn-hangzhou&err_code=524&err_msg=524 Host not found by dns resolve [@ou070302]

err_code 250 indicates that sending succeeded. Any other return codes indicate that sending failed.

Appendix: List of message content parameters

Name Description
env_id System internal ID (used for feedback of inquiries).
msg_id The Message-ID field of the email text.
account The sender address.
from The sender address.
rcpt The recipient address.
recv_time The time when the email is received in the queue.
end_time The time when the email delivery is completed.
status The results of the delivery (0-success, 2-invalid address, 3-spam mail on the receiving side, 4-failure).
err_code The ESP return code from the receiving side after the delivery is done.
err_msg The ESP return information from the receiving side after the delivery is done.