简体   繁体   中英

AWS SES SendBulkTemplatedEmailResponse for tracking email statues

I am referring to .net SDK here but I believe class level concepts are all same.

This is for sending bulk emails using templates ( https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-personalized-email-api.html )

https://docs.aws.amazon.com/sdkfo.net/v3/apidocs/items/SimpleEmail/TSendBulkTemplatedEmailResponse.html

SendBulkTemplatedEmailResponse response = client.SendBulkTemplatedEmailAsync(sendBulkTemplatedEmailRequest).Result

SendBulkTemplatedEmailRequest has more than one email addresses and SendBulkTemplatedEmailResponse is returned with individual status for each email as List<BulkEmailDestinationStatus> ( https://docs.aws.amazon.com/sdkfo.net/v3/apidocs/items/SimpleEmail/TBulkEmailDestinationStatus.html ).

Each BulkEmailDestinationStatus has MessageId and Status (some predefined constants). But not having the email-address for which the status is returned (obviously there are more than one recipients so there are individual status for each recipient.)

With that said, how to figure out mapping from email-address to MessageId or vice-versa?

I am getting confused about what is the use of messageId in BulkEmailDestinationStatus where there is not any associated recipient email-address. Am I missing something very basic here?

While I didn't find any resources on this, I'll just leave what I gathered testing this feature, for anyone else that may find this question.

The order of the emails sent (ie. the order of the emails in the Destinations property) is the order of the returned messageIds.

So, using the docs json sample:

{
  "Source":"Mary Major <mary.major@example.com>",
  "Template":"MyTemplate",
  "ConfigurationSetName": "ConfigSet",
  "Destinations":[
    {
      "Destination":{
        "ToAddresses":[
          "anaya.iyengar@example.com"
        ]
      },
      "ReplacementTemplateData":"{ \"name\":\"Anaya\", \"favoriteanimal\":\"angelfish\" }"
    },
    {
      "Destination":{ 
        "ToAddresses":[
          "liu.jie@example.com"
        ]
      },
      "ReplacementTemplateData":"{ \"name\":\"Liu\", \"favoriteanimal\":\"lion\" }"
    },
    {
      "Destination":{
        "ToAddresses":[
          "shirley.rodriguez@example.com"
        ]
      },
      "ReplacementTemplateData":"{ \"name\":\"Shirley\", \"favoriteanimal\":\"shark\" }"
    },
    {
      "Destination":{
        "ToAddresses":[
          "richard.roe@example.com"
        ]
      },
      "ReplacementTemplateData":"{}"
    }
  ],
  "DefaultTemplateData":"{ \"name\":\"friend\", \"favoriteanimal\":\"unknown\" }"
}

The object sent would be a (SendBulkTemplatedEmailRequest) request with the following list:

request.Destinations[0].ToAddresses = {"anaya.iyengar@example.com"}
request.Destinations[1].ToAddresses = {"liu.jie@example.com"}
request.Destinations[2].ToAddresses = {"shirley.rodriguez@example.com"}
request.Destinations[3].ToAddresses = {"richard.roe@example.com"}

And the (SendBulkTemplatedEmailResponse) response would have this list:

response.Status[0].MessageId = "0000000000000000-11111111-2222-3333-4444-111111111111-000000"
response.Status[1].MessageId = "0000000000000000-11111111-2222-3333-4444-222222222222-000000"
response.Status[2].MessageId = "0000000000000000-11111111-2222-3333-4444-333333333333-000000"
response.Status[3].MessageId = "0000000000000000-11111111-2222-3333-4444-444444444444-000000"

Where:

  • the MessageId "0000000000000000-11111111-2222-3333-4444-111111111111-000000" refers to the email sent to anaya.iyengar@example.com ;
  • the MessageId "0000000000000000-11111111-2222-3333-4444-222222222222-000000" refers to to the email sent to "liu.jie@example.com" ;

and so on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM