---
title: "How to Send Email from Replit with AWS SES: DNS, DKIM & IAM Setup Guide"
description: "Learn how to set up AWS SES for transactional email in Replit apps with step-by-step instructions for domain verification, DKIM configuration, DNS records, IAM credentials, and code examples in Python and TypeScript to avoid common delivery failures."
image: "https://cdn.sethserver.com/blog-images/sending-email-from-your-replit-app-with-aws-ses-social-1767152529.webp"
---

# How to Send Email from Replit with AWS SES: DNS, DKIM & IAM Setup Guide

You can [build a whole app on Replit in an afternoon](https://www.sethserver.com/programming/insanely-rapid-ai-assisted-development-with-replit.html). Then you try to send one email and you're knee-deep in DNS records at 1am wondering why you didn't just use a third-party service.

AWS SES is my go-to for transactional email. It's cheap and it works. I've been using it for years. The setup has some annoying parts, but it's way better than what we used to do. I remember buying Dell servers, installing FreeBSD, configuring qmail or sendmail, manually editing DNS zone files, and hoping it all worked.

## Step 1: Verify your domain (and turn on DKIM)

In AWS Console:

- **SES - Verified identities - Create identity**
- Choose **Domain**
- Enter `yourdomain.com`
- Enable **Easy DKIM**

AWS will hand you DNS records. Usually:
- **3 CNAME records** for DKIM
- Sometimes a **TXT** record for domain ownership

### DKIM, in plain terms

DKIM is a cryptographic signature on your outgoing mail.

- AWS creates a public/private key pair
- SES signs mail with the private key
- Receiving servers (Gmail, Outlook) fetch the public key from your DNS and verify

Without DKIM, your email might still send, but it'll end up in spam or get rejected outright. Gmail and Outlook will treat it like junk mail. Just set it up.

## Step 2: Add the DNS records (don't paste the whole domain into "Name")

This is where most people get stuck for an hour.

SES gives you something like:

- Name: `abc123._domainkey.yourdomain.com`
- Value: `abc123.dkim.amazonses.com`

Most DNS providers want only the **subdomain part** in the "Name/Host" field.

### Provider quirks

- **GoDaddy:** Add CNAME. In **Name**, use `abc123._domainkey` (not the full domain). TTL: 1 hour.
- **Namecheap:** Advanced DNS - Add New Record. Host is the subdomain part. TTL: Automatic.
- **Route 53:** You can create records manually, or use "Publish to Route 53" if SES offers it. TTL: 300 is fine.

Check propagation:

```bash
dig CNAME abc123._domainkey.yourdomain.com
```

DNS can take minutes or up to 48 hours. Usually it's under an hour.

## Step 3: Get out of the SES sandbox

New SES accounts start in sandbox mode. That means you can only send **to verified addresses**.

SES - Account dashboard - **Request production access**

They'll ask:
- what you're sending
- expected volume
- how you handle bounces/complaints

Approval usually takes 24-48 hours. While you wait, verify a couple email addresses so you can test.

## Step 4: Create IAM credentials for Replit

IAM - Users - Create user: `replit-ses-sender`

Give it permission. You *can* attach `AmazonSESFullAccess`, but I prefer a tight policy:

```json
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": ["ses:SendEmail", "ses:SendRawEmail"],
    "Resource": "*"
  }]
}
```

Create an access key:
- Use case: **Application running outside AWS**
- Save the Access Key ID + Secret Access Key (you won't see the secret again)

## Step 5: Add Replit secrets

In Replit "Secrets":

- `AWS_ACCESS_KEY_ID`
- `AWS_SECRET_ACCESS_KEY`
- `AWS_REGION` (ex: `us-east-1`)
- `SES_FROM_EMAIL` (ex: `noreply@yourdomain.com`)

That from address should be on your verified domain.

## Python example (boto3)

```python
import os
import boto3
from botocore.exceptions import ClientError

ses = boto3.client(
    "ses",
    region_name=os.environ["AWS_REGION"],
    aws_access_key_id=os.environ["AWS_ACCESS_KEY_ID"],
    aws_secret_access_key=os.environ["AWS_SECRET_ACCESS_KEY"],
)

def send_email(to_address: str, subject: str, body_text: str, body_html: str | None = None) -> str:
    source = os.environ["SES_FROM_EMAIL"]

    body = {"Text": {"Data": body_text, "Charset": "UTF-8"}}
    if body_html:
        body["Html"] = {"Data": body_html, "Charset": "UTF-8"}

    try:
        resp = ses.send_email(
            Source=source,
            Destination={"ToAddresses": [to_address]},
            Message={
                "Subject": {"Data": subject, "Charset": "UTF-8"},
                "Body": body,
            },
        )
        return resp["MessageId"]
    except ClientError as e:
        raise RuntimeError(e.response["Error"]["Message"])
```

## TypeScript example (AWS SDK v3)

```ts
import { SESClient, SendEmailCommand } from "@aws-sdk/client-ses";

const client = new SESClient({
  region: process.env.AWS_REGION!,
  credentials: {
    accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
    secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
  },
});

export async function sendEmail(to: string, subject: string, bodyText: string, bodyHtml?: string) {
  const from = process.env.SES_FROM_EMAIL!;

  const cmd = new SendEmailCommand({
    Source: from,
    Destination: { ToAddresses: [to] },
    Message: {
      Subject: { Data: subject, Charset: "UTF-8" },
      Body: {
        Text: { Data: bodyText, Charset: "UTF-8" },
        ...(bodyHtml ? { Html: { Data: bodyHtml, Charset: "UTF-8" } } : {}),
      },
    },
  });

  const resp = await client.send(cmd);
  return resp.MessageId;
}
```

## Common failures (the ones you'll actually hit)

- **"Email address is not verified"**: you're still in sandbox, or the recipient isn't verified.
- **"AccessDenied"**: IAM policy is wrong, or you used the wrong keys.
- **"MessageRejected"**: from-address isn't on your verified domain, or DKIM isn't verified yet.
- **Spam folder**: DKIM missing/broken, or your domain has zero reputation. Start low volume. Don't blast.

SES will let you send a lot of email. AWS expects you to not be stupid about it. Watch your bounce rate (keep it under 5%) and complaint rate (under 0.1%), or they'll shut you down fast.

Now you can actually send email from your Replit app without setting up a mail server. You still have to do DNS, though. When you're ready to [deploy your Replit app to production](https://www.sethserver.com/programming/aws-lightsail-the-final-piece-of-the-replit-to-production-puzzle.html), you'll want proper error tracking—consider [setting up structured logging](https://www.sethserver.com/python/python-logging-done-right.html) so you can debug email delivery issues in production.

-Sethers


```json
{"@context": "https://schema.org", "@type": "BlogPosting", "headline": "How to Send Email from Replit with AWS SES: DNS, DKIM & IAM Setup Guide", "datePublished": "2025-12-12T04:02:24", "dateModified": "2026-09-17T19:47:54", "image": {"@type": "ImageObject", "url": "https://cdn.sethserver.com/blog-images/sending-email-from-your-replit-app-with-aws-ses-social-1767152529.webp", "width": 400, "height": 400}, "url": "https://www.sethserver.com/programming/sending-email-from-your-replit-app-with-aws-ses.html", "author": {"@type": "Person", "name": "Seth Black", "url": "https://www.linkedin.com/in/seth-black-tx"}, "publisher": {"@type": "Organization", "name": "Sethserver", "logo": {"@type": "ImageObject", "url": "https://www.sethserver.com/static/images/PaperAirplane512.png"}}, "description": "Learn how to set up AWS SES for transactional email in Replit apps with step-by-step instructions for domain verification, DKIM configuration, DNS records, IAM credentials, and code examples in Python and TypeScript to avoid common delivery failures.", "articleSection": "Technology"}
{"@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{"@type": "ListItem", "position": 1, "name": "sethserver", "item": "https://www.sethserver.com/"}, {"@type": "ListItem", "position": 2, "name": "Programming", "item": "https://www.sethserver.com/programming/"}, {"@type": "ListItem", "position": 3, "name": "How to Send Email from Replit with AWS SES: DNS, DKIM & IAM Setup Guide", "item": "https://www.sethserver.com/programming/sending-email-from-your-replit-app-with-aws-ses.html"}]}
```
