Custom headers support in SES sendBulkTemplatedEmail command

4

I need to be able to add custom email headers while sending out hundreds (potentially thousands) of emails at a time using the SES sendBulkTemplatedEmail command. How can I do this?

  • I think I have worked it out:

    In your destinations object you need to pass ReplacementTags with an object of:

    {
      "Template": {
        "TemplateName": "string",
        "TemplateArn": "string",
        "TemplateData": "string",
        "Headers": [
          {
            "Name": "List-Unsubscribe",
            "Value": "your-string-value"
          }
          ...
        ]
      }
    }
    

    --EDIT--

    Sorry this is wrong

asked 6 months ago329 views
3 Answers
1

Below quotes are from the recent AWS article:

"In a move to safeguard user inboxes, Gmail and Yahoo Mail announced a new set of requirements for senders effective from February 2024."

  1. Set up an easy unsubscribe for email recipients Bulk senders are expected to include a mechanism to unsubscribe by adding an easy to find link within the message. The February 2024 mailbox provider rules will require senders to additionally add one-click unsubscribe headers as defined by RFC 2369 and RFC 8058. These headers make it easier for recipients to unsubscribe, which reduces the rate at which recipients will complain by marking messages as spam.

To set up one-click unsubscribe without using the SES subscription management feature, include both of these headers in outgoing messages:

List-Unsubscribe-Post: List-Unsubscribe=One-Click

List-Unsubscribe: https://example.com/unsubscribe/example

How can we use sendBulkTemplatedEmail API to add List-Unsubscribe-Post and List-Unsubscribe headers? With a quick look at the API documentation, I don't see any ways to add these headers. We do not wish to use SES subscription management feature as we already have our subscription management page where the user can unsubscribe.

Going forward, this seems like an essential feature that needs to be supported.

answered 4 months ago
  • Yeah it doesn't make sense they're putting all this info out about requiring this but then not making it easy to actually do it

0

Hello, SESv2 API recently added support for custom headers to sendBulkEmail, however it's rather useless. :(

I've created a file sesv2-header-test.json with the following content:

{
        "FromEmailAddress": "info@nastojte.cz",
        "DefaultContent": {
                "Template": {
                        "TemplateName": "example",
                        "TemplateData": "{\"UNSUBSCRIBE\":\"0\"}",
                        "Headers": [
                                {"Name":"List-Unsubscribe-Post", "Value": "List-Unsubscribe=One-Click"},
                                {"Name":"List-Unsubscribe", "Value": "<https://nastojte.cz/unsubscribe?={{UNSUBSCRIBE}}>"}
                        ]
                }
        },
        "BulkEmailEntries": [
                {
                        "Destination": {
                                "ToAddresses": [
                                        "adam@nastojte.cz"
                                ]
                        },
                        "ReplacementEmailContent": {
                                "ReplacementTemplate": {
                                        "ReplacementTemplateData": "{\"UNSUBSCRIBE\":\"1234\"}"
                                }
                        }
                }
        ]
}

And the send the e-mail using this command in the CloudShell: aws sesv2 send-bulk-email --cli-input-json "$(cat sesv2-header-test.json)"

What I am attempting to do is to replace the placeholder value in the Headers section with my ReplacementTemplateData (1234 in the example being my unique message ID I can use for unsubscribe), but this does not work (the message is sent, but the{{UNSUBSCRIBE}} placeholder is not replaced). As a result, I have no way to distinguish individual recipients of the e-mails sent in bulk from each other, as the One-Click Unsubscribe does not provide any information about the e-mail other than the information encoded in the URI - which is the same for all the recipeints as variables are not replaced properly :(

answered 2 months ago
  • Same experience here. I do not understand the point of developing this feature (setting up headers in bulk) if the main purpose of it (satisfying the ISP requests for unsub) is not available because it is so limited...

  • Glad to see your post as I have been wondering if I am doing something wrong here. I suppose we will need to send emails individually with SendEmailRequest... Actually spoke too soon, V2 doesn't support templates. Maybe we can send 1000's of bulk requests with 1 email in each request :(

  • Same problem here... any news from aws team about this limitation? Has anyone found a reasonable workaround?

0

Agreed. Actually, they are not even making it "not easy" to actually do it. They are plainly not making it possible at all at the moment. And user SendEmail (to be able to set the headers) instead is not an option for bulk messages this templates...

hlg
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions