
Building a Serverless Email Forwarder
How I Used AWS SES to Route Business Emails to Gmail for $0.21/Month
If you want to be taken seriously as a business—especially when applying for government tenders or dealing with B2B clients—you cannot use a standard
@gmail.com address. A custom domain email (like support@shopmultitouch.com ) sends a massive trust signal. It says you are an established, professional entity, not just a fleeting side hustle.I needed that professional front for my enterprise, but there was a catch. I am currently a one-person operation. I can afford the $4/month for AWS WorkMail or $6/month for Google Workspace, but subscribing to a dedicated inbox just to log in, read an email, and log out makes zero sense.
Amazon has a famous leadership principle: Frugality. Accomplishing more with less. When brainstorming solutions, an AI suggested I could piece together a small, serverless mail forwarder using AWS services. It was the perfect frugal engineering challenge.
In this guide, I will show you how to build a production-ready, serverless email-receiving pipeline using Amazon SES, Amazon S3, and AWS Lambda that forwards custom domain emails straight into your personal Gmail.
Architecture Overview
Here is how we route the data without paying for a traditional mail server:

- Sender emails
support@shopmultitouch.com.
- Route 53 (DNS) uses an MX record to route the message to Amazon SES (in
us-east-1).
- SES Receipt Rule triggers two concurrent actions:
- Saves the raw email file into an Amazon S3 bucket.
- Invokes a Node.js Lambda Function.
- Lambda fetches the email from S3, rewrites the headers (to prevent strict DMARC/SPF spam rejections), and uses SES to dispatch it straight to your personal Gmail.
Step 1: DNS & Domain Verification in SES
Note: SES email receiving rules only operate in specific regions. We are using
us-east-1 .Go to AWS Console → Amazon SES (ensure your region is
us-east-1 ).
- Navigate to Verified identities → Create identity.
- Choose Domain, enter your domain name, and click Create identity.

- Add this MX Record to your DNS registrar (e.g., Route 53):
- Type:
MX
- Name/Host: (blank for root domain)
- Priority:
10
- Value:
inbound-smtp.us-east-1.amazonaws.com

Step 2: The S3 Storage Bucket
Incoming emails must be temporarily stored before our Lambda parses them.
- Go to Amazon S3 and create a bucket (e.g.,
shopmultitouch-email-storageinus-east-1).
- Block all public access.
- Attach this bucket policy to allow SES to write files (replace
YOUR-AWS-ACCOUNT-ID):
{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowSESPuts", "Effect": "Allow", "Principal": { "Service": "ses.amazonaws.com" }, "Action": "s3:PutObject", "Resource": "arn:aws:s3:::yourdomainemail-storage/*", "Condition": { "StringEquals": { "AWS:SourceAccount": "YOUR-AWS-ACCOUNT-ID" } } } ]}
Step 3: Verifying Your Personal Gmail
To ensure SES can forward emails to your personal inbox without triggering anti-spam rejections, you must verify the destination address.
- In SES → Verified identities, click Create identity.
- Select Email address and input your personal Gmail.
- Click the verification link sent to your inbox.

Step 4: The Lambda Forwarder
Create an AWS Lambda function using Node.js 20.x.
IAM Permissions
In your Lambda's Configuration → Permissions, attach these policies to the execution role:
-
AmazonS3FullAccess(scope this down for production)
-
AmazonSESFullAccess

The Code ( index.mjs )
This script fetches the email from S3, cleanly rewrites the
From and Reply-To headers to survive Gmail's strict spoofing checks, and fires it off.import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3";import { SESClient, SendRawEmailCommand } from "@aws-sdk/client-ses";
const s3 = new S3Client({ region: "us-east-1" });const ses = new SESClient({ region: "us-east-1" });
const config = { fromEmail: "support@s<PLACEME>com", emailBucket: "s<REPLACEME>cemail-storage", emailKeyPrefix: "", forwardMapping: { "support@<REPLACEME>com": ["your.personal@gmail.com"] }};
export const handler = async (event) => { const record = event.Records[0]; const msgId = record.ses.mail.messageId; const recipients = record.ses.receipt.recipients;
// 1. Fetch raw email from S3 const s3Response = await s3.send(new GetObjectCommand({ Bucket: config.emailBucket, Key: config.emailKeyPrefix + msgId, })); let emailData = await s3Response.Body.transformToString();
// 2. Map recipients let forwardTo = []; for (const recipient of recipients) { const lower = recipient.toLowerCase(); if (config.forwardMapping[lower]) { forwardTo = forwardTo.concat(config.forwardMapping[lower]); } }
if (forwardTo.length === 0) return;
// 3. Rewrite headers to prevent SPF/DKIM validation failures const originalFrom = emailData.match(/^From: (.+)$/m)?.[1] || "Unknown Sender"; emailData = emailData.replace(/^From: .+$/m, `From: ${config.fromEmail}`); emailData = emailData.replace(/^Return-Path: .+$/m, `Return-Path: ${config.fromEmail}`); // Inject Reply-To so hitting "Reply" in Gmail talks directly to the client emailData = emailData.replace( /^(From: .+)$/m, `$1\nReply-To: ${originalFrom}\nX-Original-From: ${originalFrom}` );
// 4. Dispatch via SES await ses.send(new SendRawEmailCommand({ Source: config.fromEmail, Destinations: forwardTo, RawMessage: { Data: Buffer.from(emailData) }, }));};
Tip: Increase your Lambda Timeout to 30 seconds in General Configuration.
Step 5: Setting Up SES Receipt Rules
Finally, tell SES what to do when an email arrives.
- Go to SES → Email receiving → Create rule set. Name it
PrimaryRuleSetand set it as active.
- Inside the rule set, click Create rule:
- Recipient conditions: Add
support@shopmultitouch.com
- Action 1: Deliver to S3 bucket (
shopmultitouch-email-storage)
- Action 2: Invoke Lambda function (your forwarder function)

(Pro-Tip: Go into your Gmail Settings → Filters, and create a filter for emails sent to your support address to "Always mark as important" and apply a specific label so they don't get buried).
The Cost: Why Frugality Wins
Here is the exact math for receiving and forwarding 1,000 business emails per month using this serverless pipeline:
Service | Cost Calculation | Estimated Monthly Cost |
|---|---|---|
Amazon SES | $0.10 per 1,000 incoming mail chunks | $0.10 |
Amazon S3 | 100MB storage + PUT/GET Requests | $0.01 |
AWS Lambda | 1,000 invocations (Covered by Free Tier) | $0.00 |
Amazon SES | $0.10 per 1,000 outgoing emails | $0.10 |
Total Cost | | ~$0.21 / month |
By embracing serverless architecture, I get the trust signals of a dedicated enterprise email for government tenders, the convenience of managing everything from my personal phone, and an operating cost that is practically a rounding error. That is frugal engineering.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article