<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Serverless Scheduled Email Notifier — AWS SES + Lambda</title>
<style>
@page { margin: 28px 34px; }
* { box-sizing: border-box; }
body {
font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
color: #1c2530;
margin: 0;
padding: 0 6px;
line-height: 1.5;
font-size: 13px;
}
h1 {
font-size: 22px;
margin: 0 0 4px 0;
color: #0b3d91;
}
.subtitle {
color: #4a5768;
font-size: 13px;
margin-bottom: 18px;
}
h2 {
font-size: 15px;
color: #0b3d91;
border-bottom: 2px solid #d7e3f4;
padding-bottom: 4px;
margin-top: 24px;
margin-bottom: 10px;
}
.badges { margin: 10px 0 20px 0; }
.badge {
display: inline-block;
background: #eaf1fc;
color: #0b3d91;
border: 1px solid #c3d7f4;
border-radius: 12px;
padding: 3px 10px;
font-size: 11px;
margin: 2px 4px 2px 0;
}
table {
width: 100%;
border-collapse: collapse;
margin: 8px 0 4px 0;
font-size: 12.5px;
}
th, td {
border: 1px solid #dde5ef;
padding: 6px 8px;
text-align: left;
vertical-align: top;
}
th {
background: #f2f6fc;
color: #0b3d91;
}
code, .mono {
font-family: "SFMono-Regular", Menlo, Consolas, monospace;
background: #f2f6fc;
padding: 1px 5px;
border-radius: 4px;
font-size: 11.5px;
color: #0b3d91;
}
ul { margin: 6px 0; padding-left: 20px; }
li { margin: 3px 0; }
.diagram-wrap {
text-align: center;
margin: 10px 0 6px 0;
}
.caption {
text-align: center;
color: #64748b;
font-size: 11px;
margin-top: 4px;
}
.footer {
margin-top: 26px;
padding-top: 8px;
border-top: 1px solid #dde5ef;
color: #7a8798;
font-size: 10.5px;
}
.page-break { page-break-before: always; }
.screenshot-grid {
display: flex;
gap: 14px;
margin-top: 10px;
}
.screenshot-card {
flex: 1;
border: 1px solid #dde5ef;
border-radius: 8px;
overflow: hidden;
text-align: center;
background: #fff;
}
.screenshot-card img {
width: 100%;
display: block;
}
.screenshot-card .cap {
padding: 7px 8px;
font-size: 11px;
color: #3d4b5c;
background: #f8fafc;
border-top: 1px solid #dde5ef;
}
.screenshot-card .cap b { color: #0b3d91; }
</style>
</head>
<body>
<h1>Serverless Scheduled Email Notifier</h1>
<div class="subtitle">AWS Lambda · Amazon SES · Amazon EventBridge Scheduler — a hands-on project exploring SES as a verified sending domain with multiple identities</div>
<div class="badges">
<span class="badge">AWS Lambda</span>
<span class="badge">Amazon SES</span>
<span class="badge">Amazon EventBridge</span>
<span class="badge">IAM</span>
<span class="badge">CloudWatch Logs</span>
<span class="badge">Python (boto3)</span>
<span class="badge">Serverless</span>
</div>
<h2>Overview</h2>
<p>
This project was built to understand how Amazon SES works as a verified sending <strong>domain</strong> with multiple
named identities. The domain <span class="mono">sharathonline.com</span> is verified once in SES, and three distinct
"personas" send from it: <span class="mono">happy-morning@sharathonline.com</span>,
<span class="mono">happy-evening@sharathonline.com</span>, and <span class="mono">story-time@sharathonline.com</span>.
Three independent AWS Lambda functions generate content and send email through SES, each triggered on its own
weekday schedule via Amazon EventBridge — with no servers to manage.
</p>
<h2>Architecture Diagram</h2>
<div class="diagram-wrap">
<svg viewBox="0 0 1000 520" xmlns="http://www.w3.org/2000/svg" width="100%" height="480">
<defs>
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M0,0 L10,5 L0,10 z" fill="#375a99"/>
</marker>
</defs>
<!-- Schedulers -->
<rect x="20" y="20" width="480" height="55" rx="8" fill="#fff4e0" stroke="#d99a2b" stroke-width="1.5"/>
<rect x="30" y="29" width="36" height="36" rx="6" fill="#E7157B"/>
<circle cx="48" cy="47" r="10" fill="none" stroke="#ffffff" stroke-width="2"/>
<path d="M48 40 L48 47 L53 50" stroke="#ffffff" stroke-width="2" fill="none" stroke-linecap="round"/>
<text x="280" y="43" font-size="12" text-anchor="middle" fill="#7a4e00" font-weight="bold">Amazon EventBridge Scheduler</text>
<text x="280" y="61" font-size="11.5" text-anchor="middle" fill="#7a4e00">Weekdays @ 10:00 AM IST</text>
<rect x="770" y="20" width="210" height="55" rx="8" fill="#fff4e0" stroke="#d99a2b" stroke-width="1.5"/>
<rect x="780" y="29" width="36" height="36" rx="6" fill="#E7157B"/>
<circle cx="798" cy="47" r="10" fill="none" stroke="#ffffff" stroke-width="2"/>
<path d="M798 40 L798 47 L803 50" stroke="#ffffff" stroke-width="2" fill="none" stroke-linecap="round"/>
<text x="895" y="43" font-size="12" text-anchor="middle" fill="#7a4e00" font-weight="bold">EventBridge</text>
<text x="895" y="61" font-size="11.5" text-anchor="middle" fill="#7a4e00">Weekdays @ 6:30 PM IST</text>
<!-- Lambda row -->
<rect x="20" y="120" width="230" height="65" rx="8" fill="#e8f0fe" stroke="#3f6fc9" stroke-width="1.5"/>
<rect x="30" y="129" width="32" height="32" rx="6" fill="#ED7100"/>
<text x="46" y="153" font-size="18" text-anchor="middle" fill="#ffffff" font-weight="bold" font-family="Georgia, serif">λ</text>
<text x="148" y="140" font-size="9" text-anchor="middle" fill="#8a5300">AWS Lambda</text>
<text x="148" y="152" font-size="11.5" text-anchor="middle" fill="#1a3a6e" font-weight="bold">morning-mailer.py</text>
<text x="148" y="168" font-size="10" text-anchor="middle" fill="#3a537a">random quote from quotes.txt</text>
<rect x="270" y="120" width="230" height="65" rx="8" fill="#e8f0fe" stroke="#3f6fc9" stroke-width="1.5"/>
<rect x="280" y="129" width="32" height="32" rx="6" fill="#ED7100"/>
<text x="296" y="153" font-size="18" text-anchor="middle" fill="#ffffff" font-weight="bold" font-family="Georgia, serif">λ</text>
<text x="398" y="140" font-size="9" text-anchor="middle" fill="#8a5300">AWS Lambda</text>
<text x="398" y="152" font-size="11.5" text-anchor="middle" fill="#1a3a6e" font-weight="bold">story-mailer.py</text>
<text x="398" y="168" font-size="10" text-anchor="middle" fill="#3a537a">fetches story + moral via HTTPS</text>
<rect x="520" y="120" width="230" height="65" rx="8" fill="#f3edfb" stroke="#7c5cb5" stroke-width="1.5" stroke-dasharray="5,3"/>
<text x="635" y="145" font-size="12" text-anchor="middle" fill="#4b2e83" font-weight="bold">External API</text>
<text x="635" y="162" font-size="10.5" text-anchor="middle" fill="#5b3f8f">shortstories-api</text>
<text x="635" y="175" font-size="10.5" text-anchor="middle" fill="#5b3f8f">.onrender.com</text>
<rect x="770" y="120" width="210" height="65" rx="8" fill="#e8f0fe" stroke="#3f6fc9" stroke-width="1.5"/>
<rect x="780" y="129" width="32" height="32" rx="6" fill="#ED7100"/>
<text x="796" y="153" font-size="18" text-anchor="middle" fill="#ffffff" font-weight="bold" font-family="Georgia, serif">λ</text>
<text x="898" y="140" font-size="9" text-anchor="middle" fill="#8a5300">AWS Lambda</text>
<text x="898" y="152" font-size="11.5" text-anchor="middle" fill="#1a3a6e" font-weight="bold">evening-mailer.py</text>
<text x="898" y="168" font-size="10" text-anchor="middle" fill="#3a537a">random quote from quotes.txt</text>
<!-- Scheduler -> Lambda arrows -->
<line x1="148" y1="75" x2="148" y2="118" stroke="#375a99" stroke-width="1.5" marker-end="url(#arrow)"/>
<line x1="398" y1="75" x2="398" y2="118" stroke="#375a99" stroke-width="1.5" marker-end="url(#arrow)"/>
<line x1="898" y1="75" x2="898" y2="118" stroke="#375a99" stroke-width="1.5" marker-end="url(#arrow)"/>
<!-- story-mailer <-> external API -->
<line x1="500" y1="147" x2="518" y2="147" stroke="#7c5cb5" stroke-width="1.5" marker-end="url(#arrow)"/>
<line x1="518" y1="160" x2="500" y2="160" stroke="#7c5cb5" stroke-width="1.5" marker-end="url(#arrow)"/>
<!-- SES group -->
<rect x="10" y="220" width="980" height="95" rx="10" fill="none" stroke="#c98a1f" stroke-width="1.3" stroke-dasharray="4,3"/>
<text x="500" y="235" font-size="11.5" text-anchor="middle" fill="#a56900" font-weight="bold">Amazon SES — Verified Domain: sharathonline.com</text>
<rect x="30" y="245" width="210" height="55" rx="8" fill="#fde9e0" stroke="#c1552b" stroke-width="1.5"/>
<rect x="38" y="253" width="28" height="28" rx="5" fill="#8C4FFF"/>
<path d="M40 256 L52 256 L52 274 L40 274 Z M40 256 L46 265 L52 256" stroke="#ffffff" stroke-width="1.3" fill="none"/>
<text x="148" y="264" font-size="11" text-anchor="middle" fill="#7a2c0e" font-weight="bold">happy-morning@</text>
<text x="148" y="279" font-size="11" text-anchor="middle" fill="#7a2c0e" font-weight="bold">sharathonline.com</text>
<rect x="280" y="245" width="210" height="55" rx="8" fill="#fde9e0" stroke="#c1552b" stroke-width="1.5"/>
<rect x="288" y="253" width="28" height="28" rx="5" fill="#8C4FFF"/>
<path d="M290 256 L302 256 L302 274 L290 274 Z M290 256 L296 265 L302 256" stroke="#ffffff" stroke-width="1.3" fill="none"/>
<text x="398" y="264" font-size="11" text-anchor="middle" fill="#7a2c0e" font-weight="bold">story-time@</text>
<text x="398" y="279" font-size="11" text-anchor="middle" fill="#7a2c0e" font-weight="bold">sharathonline.com</text>
<rect x="770" y="245" width="210" height="55" rx="8" fill="#fde9e0" stroke="#c1552b" stroke-width="1.5"/>
<rect x="778" y="253" width="28" height="28" rx="5" fill="#8C4FFF"/>
<path d="M780 256 L792 256 L792 274 L780 274 Z M780 256 L786 265 L792 256" stroke="#ffffff" stroke-width="1.3" fill="none"/>
<text x="898" y="264" font-size="11" text-anchor="middle" fill="#7a2c0e" font-weight="bold">happy-evening@</text>
<text x="898" y="279" font-size="11" text-anchor="middle" fill="#7a2c0e" font-weight="bold">sharathonline.com</text>
<text x="960" y="237" font-size="8" text-anchor="end" fill="#8C4FFF" font-weight="bold">Amazon SES</text>
<!-- Lambda -> SES arrows -->
<line x1="148" y1="185" x2="148" y2="243" stroke="#375a99" stroke-width="1.5" marker-end="url(#arrow)"/>
<line x1="398" y1="185" x2="398" y2="243" stroke="#375a99" stroke-width="1.5" marker-end="url(#arrow)"/>
<line x1="898" y1="185" x2="898" y2="243" stroke="#375a99" stroke-width="1.5" marker-end="url(#arrow)"/>
<!-- Recipient -->
<rect x="350" y="360" width="300" height="55" rx="8" fill="#e6f6ec" stroke="#2e8b57" stroke-width="1.5"/>
<text x="500" y="383" font-size="12" text-anchor="middle" fill="#1f5c3a" font-weight="bold">Recipient Inbox(es)</text>
<text x="500" y="399" font-size="10.5" text-anchor="middle" fill="#2b6b46">via RECIPIENT_EMAIL env var</text>
<line x1="148" y1="300" x2="470" y2="358" stroke="#375a99" stroke-width="1.3" marker-end="url(#arrow)"/>
<line x1="398" y1="300" x2="490" y2="358" stroke="#375a99" stroke-width="1.3" marker-end="url(#arrow)"/>
<line x1="898" y1="300" x2="560" y2="358" stroke="#375a99" stroke-width="1.3" marker-end="url(#arrow)"/>
<!-- CloudWatch -->
<rect x="30" y="440" width="260" height="50" rx="8" fill="#eef1f5" stroke="#66788f" stroke-width="1.3" stroke-dasharray="4,3"/>
<rect x="40" y="448" width="28" height="28" rx="5" fill="#E7157B"/>
<circle cx="54" cy="462" r="7" fill="none" stroke="#ffffff" stroke-width="1.4"/>
<circle cx="54" cy="462" r="2.2" fill="#ffffff"/>
<text x="185" y="460" font-size="11" text-anchor="middle" fill="#3d4b5c" font-weight="bold">Amazon CloudWatch Logs</text>
<text x="185" y="475" font-size="10" text-anchor="middle" fill="#5a6b7d">execution logs & errors</text>
<line x1="148" y1="185" x2="170" y2="438" stroke="#8896a6" stroke-width="1.1" stroke-dasharray="3,3" marker-end="url(#arrow)"/>
<line x1="398" y1="185" x2="200" y2="438" stroke="#8896a6" stroke-width="1.1" stroke-dasharray="3,3" marker-end="url(#arrow)"/>
<line x1="898" y1="185" x2="240" y2="438" stroke="#8896a6" stroke-width="1.1" stroke-dasharray="3,3" marker-end="url(#arrow)"/>
</svg>
</div>
<div class="caption">Fig. 1 — Scheduled, event-driven email pipeline across three independent Lambda functions sharing one verified SES domain</div>
<h2>Lambda Functions</h2>
<table>
<tr>
<th style="width:16%">Function</th>
<th style="width:20%">Sender Identity</th>
<th style="width:20%">Content Source</th>
<th style="width:20%">Schedule (EventBridge)</th>
<th>Notes</th>
</tr>
<tr>
<td><span class="mono">morning-mailer.py</span></td>
<td>happy-morning@sharathonline.com</td>
<td><span class="mono">quotes.txt</span> (random pick)</td>
<td>Weekdays, 10:00 AM IST</td>
<td>Supports multiple recipients (comma/semicolon separated) from one env var</td>
</tr>
<tr>
<td><span class="mono">evening-mailer.py</span></td>
<td>happy-evening@sharathonline.com</td>
<td>Accomplishment-themed quotes file</td>
<td>Weekdays, 6:30 PM IST</td>
<td>Same random-quote pattern, different tone/content set</td>
</tr>
<tr>
<td><span class="mono">story-mailer.py</span></td>
<td>story-time@sharathonline.com</td>
<td>External API: shortstories-api.onrender.com</td>
<td>Weekdays, 10:00 AM IST</td>
<td>Subject line built dynamically from the story's moral; handles HTTPError/URLError</td>
</tr>
</table>
<h2>How It Works</h2>
<ul>
<li>Amazon EventBridge Scheduler rules trigger each Lambda on a cron schedule — no polling, no always-on compute.</li>
<li><span class="mono">morning-mailer</span> and <span class="mono">evening-mailer</span> read a bundled quotes file, pick one at random with <span class="mono">random.choice()</span>, and email it as plain text.</li>
<li><span class="mono">story-mailer</span> calls the public Story API over HTTPS, extracts the story and its moral, and uses the moral as the email subject.</li>
<li>All three functions read the recipient list from a <span class="mono">RECIPIENT_EMAIL</span> Lambda environment variable and support multiple comma/semicolon-separated addresses.</li>
<li>Each function sends via <span class="mono">boto3</span>'s SES <span class="mono">send_email</span> API using its own verified sender identity under the shared domain.</li>
<li>Execution logs and errors are captured automatically in Amazon CloudWatch Logs for observability.</li>
</ul>
<h2>Key Learnings</h2>
<ul>
<li>How a single verified SES <strong>domain</strong> can back multiple sender addresses/identities without re-verifying each one.</li>
<li>Designing small, single-purpose Lambda functions decoupled from their trigger schedule via EventBridge.</li>
<li>Handling external API failures gracefully (HTTPError vs. URLError) in a serverless function.</li>
<li>Passing configuration (recipients) through environment variables instead of hardcoding.</li>
</ul>
<div class="page-break"></div>
<h2>Sample Email Outputs</h2>
<div class="screenshot-grid">
<div class="screenshot-card">
<img src="screenshots/morning-mailer-sample.png" alt="morning-mailer sample email">
<div class="cap"><b>morning-mailer.py</b><br>happy-morning@sharathonline.com</div>
</div>
<div class="screenshot-card">
<img src="screenshots/evening-mailer-sample.png" alt="evening-mailer sample email">
<div class="cap"><b>evening-mailer.py</b><br>happy-evening@sharathonline.com</div>
</div>
<div class="screenshot-card">
<img src="screenshots/story-mailer-sample.png" alt="story-mailer sample email">
<div class="cap"><b>story-mailer.py</b><br>story-time@sharathonline.com</div>
</div>
</div>
<div class="caption">Fig. 2 — Actual delivered emails from each scheduled Lambda function</div>
</body>
</html>