All Products
Search
Document Center

Direct Mail:Setup Asynchronous Notifications

Last Updated:Jul 13, 2023

This topic describes how to set up asynchronous notification.

After sending an email request through DirectMail server, the delivery results will be sent to the receiving terminal (HTTP, message queue, or subject) of the message service according to the event notification rules you set in the 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.

To set asynchronous notification, you need to create event notification rules on the Message Service Console and then create asynchronous notifications on the DirectMail Console. Therefore, you need to enable the Message Service and it may incur fees.

Please use main account of Alibaba Cloud to setup asynchronous notification. The Message Service does not support RAM at present.

Create Event Notification Rules

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

Create Messages Receiving Queue

  1. Log on to the Message Service Console.

  2. On the left-side navigation pane, click Queues.

  3. Click the Create Queue button on the page then a dialog box appears.

  4. Fill the queue name, use the default values for other fields, and click OK.

image

Create Event Notifications Rules

1. On the left-side navigation pane on the Message Service Console, click Event Notifications.

2. Click the Create Rule button on the page then a dialog box appears.

3. Check the region and product name, fill the rule name, select the event type, add the receiving terminal, and click OK. Currently, the system supports two types of receiving terminals (HTTP and Queue). You may select the created message receiving queue as the receiving terminal.

image

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

Please check "Event type" reference below.

Create Asynchronous Notifications

Asynchronous notifications can be divided into asynchronous notifications at the account-level and at the email 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 email addresses, you may 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 one. The specified sender addresses get the email address-level asynchronous notifications, while all the other sender addresses get the account-level asynchronous notifications. This allows you to send notifications for specific accounts to different message receiving terminals.

Create Account-level Asynchronous Notifications

1. Log on to DirectMail Console.

2. On the left-side navigation pane, click Asynchronous Notifications.

3. Click the New Account-level Asynchronous Notifications button on the page.

4. Select the region and click OK.

imagecreate notification

Create Email Address-level Asynchronous Notifications

1. Click Email Address-level Asynchronous Notification on the Asynchronous Notifications page.

2. Click the New Address-level Asynchronous Notifications button on the page.

3. Select the sender address and region, and click OK.image

Create address-level notification

The Message Service Console receives the queue message and verifies that the link is valid.

After sending an email request through the DirectMail server

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 before.

4. Click Send Messages to view the specific event notifications pushed to the queue.

image.pngimage.png

Event Type and Enable Method

Event type currently supports following categories,

  • Deliver:SendSuccessfully

  • Deliver:SendFailed

  • Deliver:Open

  • Deliver:Click

How to enable statistics on Deliver:SendSuccessfully and Deliver:SendFailed?

It will collect delivery information by default.

How to enable statistics on Deliver:Open and Deliver:Click?

Please refer to How Do I Enable The Data Tracking Feature?.

The Message Structure of Successful Delivery and Failed Delivery

Example of Successful Delivery

X-Notify-Message-ID=3121639760461820&env_id=12769055421&msg_id=37483d95-7a08-41fb-9738-3d3ffa24d415@example.com&account=example@example.com&from=example@example.com&rcpt=example1@example.com&recv_time=2017-03-29 14:22:40&end_time=2017-03-29 14:22:43&status=0&event=deliver&region=cn-hangzhou&err_code=250&err_msg=250 Send Mail OK&failed_type=SendOk

Example of Failed Delivery

X-Notify-Message-ID=3121639760461824&env_id=12625010655&msg_id=ac349efc-0d79-489b-affa-f178dce3e49e@example.com&account=example@example.com&from=example@example.com&rcpt=example1@example.com&recv_time=2017-03-28 19:09:49&end_time=2017-03-28 19:09:51&status=4&event=deliver&region=cn-hangzhou&err_code=524&err_msg=524 Host not found by dns resolve [@ou070302]&failed_type=SysOutDnsResolveFail

How to Resolve?

Use "&" to divide key-val and use "=" to divide key and val. The definition of key refers to Value List.

How to Distinguish Success from Failure Messages?

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

Value List

Name

Description

X-Notify-Message-ID

Set Custom Header X-Notify-Message-ID

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).

event

Event type; deliver indicates the delivery event.

region

The region where events happen.

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.

The definition of common failed_type:

Value

Definition and Suggestion

SendOk

Successful delivery

SysOutDnsResolveFail

DNS resolution of the recipient account fails. The domain name is usually invalid. Removed from your list of recipients.

SmtpMfFreq

The sending account is flow controlled.

Reduce the frequency of your emails.

SmtpContSpam

The content is judged as spam by recipients.

Optimize your email content.

SmtpAuthFail

The SPF or DKIM verification fails. Please resolve the correct SPF record and test whether DKIM is correct.

SmtpNxBox

Invalid address. Remove from your recipient list.

SysOutInvRcpt

Invalid address. Remove from your recipient list.

SmtpRcptFreq

Email receiving system fatigue control. Please temporarily stop sending letters to the current recipient.

SmtpSslTlsErr

Temporary error. SSL/TLS connection failed due to network fault or peer unavailability. Please try again.

SmtpTempErr

Temporary error. Please try again.

SmtpZPermErr

Permanent error. Do not try again. Determine the fault cause based on the message returned by recipient.

SysOutSocksConnError

The possible cause is that the peer end rejects the link or the MX record of the received domain name is incorrect.

SmtpFullBox

The recipient's mailbox is full. Please stop sending letters to the recipient.

SmtpIPFreq

The receiving system controls the incoming IP flow. Please reduce the sending speed and try again later.

SysOutSocksError

The possible cause is that the peer end rejects the link or the MX record of the received domain name is incorrect.

SysOutConnError

The possible cause is that the peer end rejects the link or the MX record of the received domain name is incorrect.

SysOutConnTooMuch

The possible cause is that the peer end rejects the link or the MX record of the received domain name is incorrect.

UnkSmtpError

Unknown error

SmtpMfdFreq

The sending domain name is flow controlled. Reduce the frequency of your messages

SmtpMiscSpam

The content is judged as spam by recipients.

Optimize your email content.

SmtpMfBad

The sender was blacklisted by the receiving system

SmtpSpfFail

The SPF verification fails. Pls resolve the right SPF record.

SmtpMfLimit

The number of messages sent by the sender during the whole day exceeded the receiver domain limit. Please try again the next day.

SmtpDmaFail

The SPF or DKIM verification fails. Please resolve the correct SPF record and test whether DKIM is correct.

SmtpProtErr

The peer protocol interaction is incorrect.

SysOutRecipientReportedSpam

Reported as spam by recipient.

The Message Structure of Opening Event

Example

event=Open&region=cn-hangzhou&env_id=270016664318&msg_id=1688486074.7.1673022065730@example.com&from=example@example.com&rcpt=example@example.com&operate_time=2023-01-07 01:43:51

Value List

Name

Description

event

Event type

region

The region where events happen

env_id

System internal ID (used for feedback of inquiries)

msgid

The Message-ID field of the email text

from

The sender address

rcpt

The recipient address

operate_time

Event operation time

The Message Structure of Clicking Event

Example

event=Click&region=cn-hangzhou&env_id=17870283365788973187&msg_id=02785cb2-71b1-4fb5-bdbb-a49dfbe3326f@example.com&from=example@example.com&

rcpt=example@example.com&operate_time=2023-01-12 09:54:09&url=httpsxxx

Value List

Name

Description

event

Event type

region

The region where events happen

env_id

System internal ID (used for feedback of inquiries)

msgid

The Message-ID field of the email text

from

The sender address

rcpt

The recipient address

operate_time

Event operation time

url

The URL of the click