Amazon SES Contact Lists: Setup, Best Practices, and Unsubscribe Management for Successful Email Campaigns

Amazon Simple Email Service (SES) Contact Lists help businesses efficiently manage and organize their email recipients. By grouping contacts based on preferences and attributes, businesses can send personalized, relevant content, improving engagement and campaign success.

Key features include:

Topic-based Preferences: Recipients can opt in or out of specific topics (e.g., promotions, updates, newsletters) for tailored communication.

Audience Segmentation: Businesses can target specific groups based on demographics or interests, ensuring content relevance.

Compliance: SES helps businesses adhere to regulations like GDPR and CAN-SPAM, managing unsubscribes and opt-outs smoothly.

Managed Preferences Page: Easily accessible to recipients, allowing them to update preferences or unsubscribe, enhancing transparency and trust.

With SES Contact Lists, businesses can foster better connections, increase engagement, and build a more satisfied audience.

SES Contact Lists Structure: Key Components

The structure of Amazon SES Contact Lists is designed to help businesses organize and send targeted communications efficiently. Here’s how it works:

Contact Lists
The foundation of the system. Contact Lists hold all the recipients’ details, such as email addresses and attributes like preferences or demographics.

Topics
Topics allow businesses to categorize the types of emails recipients can subscribe to. For example, topics could include:
Promotional Offers, Newsletters, Product Updates
Recipients can opt in or out of these topics based on their interests, ensuring they only receive relevant content.

Subscriptions
Once recipients are added to a Contact List, they can subscribe to one or more topics. This gives them control over the types of emails they wish to receive. Each recipient’s preferences are managed and stored for precise communication.

Attributes
Attributes are additional details about recipients (e.g., location, age, purchase history) that allow businesses to further segment their audience. By using attributes, businesses can send more personalized, targeted emails.

Managed Preferences Page
This page is linked in the email footer, allowing recipients to easily update their subscription preferences. They can select new topics, unsubscribe, or modify their preferences without hassle.

Managing SES Contact Lists Programmatically

While Amazon SES Contact Lists offer powerful tools for managing email recipients and their preferences, the SES console does not provide direct visibility or management of these lists. All operations must be done programmatically through the SES API. This allows businesses to automate and customize the management of contact lists, subscriptions, and topics based on their specific needs.

SES Contact List Operations

1. Create Contact List
Explanation: This operation creates a new contact list with specified topics and their default subscription status. You can use topics to categorize email communications (e.g., promotional, notifications).

const command = new CreateContactListCommand({
    ContactListName: 'my-contact-list',  // The name of the contact list being created.
    Description: 'Sample Contact List',  // A short description of the contact list.
    Topics: [  // A list of topics that users can opt into or out of.
        {
            TopicName: 'topic1',  // Name of the topic (e.g., "marketing").
            DisplayName: 'Topic 1',  // The display name shown to users (e.g., "Marketing").
            Description: 'Marketing and promotional communications',  // Description of what this topic covers.
            DefaultSubscriptionStatus: 'OPT_OUT',  // The default subscription status for this topic (e.g., OPT_IN or OPT_OUT).
        },
        {
            TopicName: 'topic2',  // Another topic (e.g., "account notifications").
            DisplayName: 'Topic 2',  // Display name for the topic.
            Description: 'Important account notifications',  // Description for the topic.
            DefaultSubscriptionStatus: 'OPT_OUT',  // Default subscription status for this topic.
        },
    ],
});

2. Add Contact
Explanation: This operation adds a new contact (email address) to a contact list and sets their subscription preferences for specific topics. It also allows you to add custom attributes (e.g., name, date added).

const command = new CreateContactCommand({
    ContactListName: 'my-contact-list',  // Name of the contact list where the new contact will be added.
    EmailAddress: 'new-contact@example.com',  // The email address of the new contact being added.
    TopicPreferences: [  // List of topic preferences that define which topics the contact will subscribe to.
        {
            TopicName: 'topic1',  // Topic name the contact is subscribing to (e.g., "marketing").
            SubscriptionStatus: 'OPT_IN',  // Subscription status: OPT_IN means the contact subscribes to this topic.
        },
    ],
    UnsubscribeAll: false,  // If true, the contact will be unsubscribed from all topics.
    AttributesData: JSON.stringify({
        dateAdded: new Date().toISOString(),  // Custom attribute: the date when the contact was added.
        firstName: 'John',  // Custom attribute: first name of the contact.
        lastName: 'Doe',  // Custom attribute: last name of the contact.
    }),
});

3. Send Email
Explanation: This operation sends an email to a list of recipients, using the list management options to ensure recipients are subscribed or unsubscribed from specific topics as per their preferences.

const command = new SendEmailCommand({
    FromEmailAddress: 'sender@example.com',  // Sender's email address.
    Destination: { ToAddresses: ['recipient@example.com'] },  // List of recipient email addresses.
    Content: {
        Simple: {
            Subject: { Data: 'Subject', Charset: 'UTF-8' },  // Email subject line and character encoding.
            Body: {
                Html: { Data: '<p>Email Body</p>', Charset: 'UTF-8' },  // HTML email body with charset.
                Text: { Data: 'Email Body', Charset: 'UTF-8' },  // Plain-text email body with charset.
            },
        },
    },
    ListManagementOptions: {  // Manages the list and topic preferences for the email recipients.
        ContactListName: 'my-contact-list',  // Name of the contact list to manage.
        TopicName: 'topic1',  // Topic name to manage for the email recipients (e.g., "marketing").
    },
});

4. Update Contact
Explanation: This operation updates the attributes and topic preferences for an existing contact in a contact list.

const command = new UpdateContactCommand({
    ContactListName: 'my-contact-list',  // The name of the contact list where the contact is located.
    EmailAddress: 'contact-to-update@example.com',  // The email address of the contact to update.
    AttributesData: JSON.stringify({
        customField: 'UpdatedValue',  // Custom attribute: an updated value for the contact.
    }),
    TopicPreferences: [  // A list of topics and subscription statuses to update.
        {
            TopicName: 'topic1',  // The topic to update.
            SubscriptionStatus: 'OPT_IN',  // New subscription status for the topic.
        },
        {
            TopicName: 'topic2',  // Another topic to update.
            SubscriptionStatus: 'OPT_OUT',  // New subscription status for the topic.
        },
    ],
});

Unsubscription Management in Email Campaigns

Why Unsubscribing is Important:

1. Legal Compliance:
Unsubscribe options help meet legal requirements (like GDPR and CAN-SPAM) by giving recipients the choice to stop receiving marketing emails.
2. User Control:
It allows recipients to manage what emails they receive, fostering a better relationship with your audience.
3. Sender Reputation:
A smooth unsubscribe process helps keep your sender reputation intact, improving email deliverability and reducing spam complaints.
4.Better Engagement:
Making it easy for people to unsubscribe means the people who stay subscribed are genuinely interested, leading to more relevant engagement.
5. Spam Complaints:
Providing an unsubscribe option helps reduce the likelihood of recipients marking your emails as spam, which can lead to your emails being blocked or filtered by email clients, negatively impacting your sender reputation.

Amazon SES Managed Unsubscribe Mechanism

How It Works:

  • AWS SES automatically generates an unsubscribe link for each recipient.
  • The link directs recipients to a page where they can opt out of future emails.

Why It’s Useful:

  • Compliance: Ensures you meet email marketing laws.
  • Simplicity: Recipients can easily unsubscribe, maintaining a positive user experience.

Using Unsubscribe in Emails

In your email content, you can use the placeholder {{amazonSESUnsubscribeUrl}} to insert the unsubscribe link dynamically.

Example:

<p>If you no longer wish to receive emails, click <a href="{{amazonSESUnsubscribeUrl}}">here to unsubscribe</a>.</p>

When the email is sent, SES replaces {{amazonSESUnsubscribeUrl}} with a unique unsubscribe link for each recipient.

Unsubscribe Page

When recipients click the unsubscribe link, they are directed to a page where they can confirm their decision.
Example page:

Key Benefits:

  • Easy Unsubscribe: SES provides a simple way for recipients to opt out.
  • Legal Compliance: Automatically handles unsubscribe requests to stay compliant.
  • Improved Engagement: Ensures that only interested recipients remain on your list.

Clone the Repository and Try the Feature

To get started and explore the feature, clone the repository by running the following command in your terminal:

git clone git@ssh.dev.azure.com:v3/7EDGEx/Backend/Backend

References:

Contributors:

This post was created with the contributions of the following individuals. For any doubts or further inquiries, feel free to contact the contributors:

9 Likes

Good Job :partying_face: @Nishan @gprasad This is a great document to refer to.

2 Likes