All Products
Search
Document Center

Direct Mail:Setup Asynchronous Notifications

Last Updated:Jun 26, 2024

This topic describes how to set up asynchronous notification. Asynchronous notifications are only available to existing users of this function. Users who have not used asynchronous notifications please use the new feature "Event Publishing" - Set Event Publishing.

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.

image

create 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.png

image.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 domain has failed, usually due to an invalid domain. Please remove the domain from your list of recipients.

SmtpMfFreq

The sending account is under flow control.

Please reduce your sending frequency.

SmtpContSpam

The content is judged as spam by recipients.

Please optimize your email content or stop sending emails with this template to recipients.

SmtpAuthFail

The SPF or DKIM or DMARC verification fails. Please resolve the correct SPF record, check if there are DMARC records configured, and test whether DKIM is correct.

SmtpNxBox

Invalid address, added to the account-level invalid address library.

SysOutInvRcpt

Hit the global invalid address library. If you confirm that the address is valid, you can report to us or choose not to enable the global level invalid address library.

SmtpRcptFreq

Email receiving system fatigue control. Please temporarily stop sending emails 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

There are too many connection errors, 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 emails to the recipient.

SmtpIPFreq

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

SysOutSocksError

There are too many connection errors, the possible cause is that the peer end rejects the link or the MX record of the received domain name is incorrect.

SysOutConnError

There are too many connection errors, the possible cause is that the peer end rejects the link or the MX record of the received domain name is incorrect.

SysOutConnTooMuch

There are too many connection errors, 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, please check the sending settings and receiving address according to the error message, and confirm that there are no errors before sending again later.

SmtpMfdFreq

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

SmtpMiscSpam

The content is judged as spam by recipients.

Optimize your email content.

SmtpMfBad

The sender was blacklisted by the receiving system, please stop sending emails to the other party, or contact the recipient's system to remove the blacklist

SmtpSpfFail

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

SmtpMfLimit

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

SmtpDmaFail

Domain configured with DMARC, 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, you can report to Alibaba Cloud troubleshooting.

SysOutRecipientReportedSpam

The recipient has reported your sending address or domain. Please stop sending emails to that recipient/domain.

SysOutHoneypot

The recipient is the honeypot address. Please stop sending emails to this address, otherwise you will be punished by the anti spam organization.

SysOutRecipientUnsubscribed

The recipient has unsubscribed from your sending address or domain. Please stop sending emails to that recipient/domain.

SysIncomingInvRcpt

Hit the global invalid address library. If you confirm that the address is valid, you can report to us or choose not to enable the global level invalid address library.

SysOutRcptOnAccountLevelBounceList

Hit account level invalid address library. If you confirm that the address is valid, you can delete it on the invalid address library page, or choose not to enable the account level invalid address library.

SmtpDbl

Hit the domain blacklist of spamhaus. Please pause sending emails and go to check.spamhaus.org to apply for delisting. After delisting, please pay attention to the quality of your emails and do not send emails to unsubscribed users.

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