Day 20: Sending HTML Emails from AWS Lambda using Python & SES.

Published: (January 16, 2026 at 11:00 AM EST)
1 min read
Source: Dev.to

Source: Dev.to

Cover image for Day 20: Sending HTML Emails from AWS Lambda using Python & SES.

Beyond Plain Text

Welcome to Day 20. SNS is great for SMS or internal alerts, but for user‑facing emails, you need HTML. Enter Amazon SES.

Prerequisites

  • Verify your email in the SES Console (Identities).
  • Add ses:SendEmail permissions to your Lambda IAM Role.

The Code (Python)

Unlike SNS which just takes a string, SES expects a dictionary structure for MIME types.

client.send_email(
    Source='me@example.com',
    Destination={'ToAddresses': ['me@example.com']},
    Message={
        'Subject': {'Data': 'My Subject'},
        'Body': {
            'Html': {'Data': '''
## Hello World
'''},          # HTML part
            'Text': {'Data': 'Hello World'}  # Plain‑text fallback
        }
    }
)

Pro Tip

Use inline CSS for email templates, as Gmail and Outlook often strip external stylesheets.

SES email example

Back to Blog

Related posts

Read more »

𝗗𝗲𝘀𝗶𝗴𝗻𝗲𝗱 𝗮 𝗣𝗿𝗼𝗱𝘂𝗰𝘁𝗶𝗼𝗻‑𝗥𝗲𝗮𝗱𝘆 𝗠𝘂𝗹𝘁𝗶‑𝗥𝗲𝗴𝗶𝗼𝗻 𝗔𝗪𝗦 𝗔𝗿𝗰𝗵𝗶𝘁𝗲𝗰𝘁𝘂𝗿𝗲 𝗘𝗞𝗦 | 𝗖𝗜/𝗖𝗗 | 𝗖𝗮𝗻𝗮𝗿𝘆 𝗗𝗲𝗽𝗹𝗼𝘆𝗺𝗲𝗻𝘁𝘀 | 𝗗𝗥 𝗙𝗮𝗶𝗹𝗼𝘃𝗲𝗿

!Architecture Diagramhttps://dev-to-uploads.s3.amazonaws.com/uploads/articles/p20jqk5gukphtqbsnftb.gif I designed a production‑grade multi‑region AWS architectu...