Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add custom headers or metadata in Amazon SES while sending emails..?

Tags:

I want to add some custom headers while sending an email through Amazon SES. I want to fetch those headers at the time of bounce notification through Amazon SNS. So how can I pass custom message id while sending emails?

Right now I'm trying to use

SendEmailRequest().putCustomRequestHeader(String, String);

But I'm not getting this headers in Amazon SNS Notification Bounce JSON. Ideas?

like image 590
Prashannjeet Avatar asked Jul 05 '16 10:07

Prashannjeet


1 Answers

Two things:

First, you need to use a RawMessage to add a custom header. You are adding a header to the SES API call, not to the message itself. See Amazon SES custom header List-Unsubscribe isn't working about this topic.

Other second issue, is Amazon SES added recently the ability to see custom headers in the notifications received due to bounces, complaints or unsubscribe responses. You must explicitly enable this feature for any domain.

You can read more about them in the blog announcement post from June 14, 2016.

The Amazon SES team is pleased to announce the addition of original email headers to the bounce, complaint, and delivery notifications SES provides through Amazon SNS.

We strive to make your email-sending process easier, and today we’re taking another step in that direction. Increasing your visibility into the feedback you receive from SES has always been a key focus for us. Starting today, the headers you pass to SES in your email-sending requests can be made available in your SNS notifications. Read on for answers to some common questions.

How do I enable this feature?

Use the Amazon SES console or API to configure the notification settings for an identity (email address or domain) and notification type (bounce, complaint, or delivery).

For example, to use the SES console to include the original headers for an identity's bounce notifications, you'd go to the notification settings for an identity and select Include original headers next to the bounce notification configuration:

SES Include Original Headers Settings

After this feature is enabled, the notifications will contain the headers in both raw name/value format and in JSON format for commonly provided headers.

like image 69
Jayson Minard Avatar answered Sep 28 '22 03:09

Jayson Minard