HTML email templates for developers
HTML email is famously frustrating. What renders perfectly in Gmail looks broken in Outlook. What works on desktop wraps strangely on mobile. The email spec is essentially frozen in 2005, and every client implements it differently.
These templates render correctly across Gmail, Outlook (including the notoriously difficult Outlook 2016 to 2019 on Windows), Apple Mail, and mobile clients. Copy, paste, adjust the colours and content, send.
Each template uses {{first_name}} and {{unsubscribe_url}}. Swap them for your provider's variable syntax if you send from somewhere else.
1. Plain announcement
Single column, mostly text. Good for product updates and changelogs. It reads like a note from a person, which tends to land in the primary inbox more often than heavily designed mail.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>What shipped in October</title>
</head>
<body style="margin:0;padding:0;background:#f4f4f5;">
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="background:#f4f4f5;">
<tr>
<td align="center" style="padding:32px 16px;">
<table role="presentation" width="600" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;background:#ffffff;">
<tr>
<td style="padding:40px;font-family:Helvetica,Arial,sans-serif;font-size:16px;line-height:24px;color:#1f1f23;">
<p style="margin:0 0 16px;">Hi {{first_name}},</p>
<p style="margin:0 0 16px;">A quick update on what shipped this month.</p>
<p style="margin:0 0 16px;"><strong>Faster exports.</strong> CSV exports now finish in seconds, even on large projects.</p>
<p style="margin:0 0 16px;"><strong>Team roles.</strong> Invite teammates as editors or viewers.</p>
<p style="margin:0;">Reply to this email if anything breaks. It comes straight to me.</p>
<p style="margin:24px 0 0;">Dana<br>Founder, YourApp</p>
</td>
</tr>
</table>
<p style="margin:24px 0 0;font-family:Helvetica,Arial,sans-serif;font-size:12px;line-height:18px;color:#71717a;">
You're receiving this because you have a YourApp account.<br>
<a href="{{unsubscribe_url}}" style="color:#71717a;">Unsubscribe</a>
</p>
</td>
</tr>
</table>
</body>
</html>2. Feature announcement
A heading, a short description, and one button. The button is a table cell with a background colour rather than a styled link alone, so it keeps its shape in Outlook. The hidden preheader sets the preview text shown next to the subject line.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Dark mode is here</title>
</head>
<body style="margin:0;padding:0;background:#f4f4f5;">
<div style="display:none;max-height:0;overflow:hidden;">Easier on the eyes, and it follows your system setting.</div>
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="background:#f4f4f5;">
<tr>
<td align="center" style="padding:32px 16px;">
<table role="presentation" width="600" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;background:#ffffff;">
<tr>
<td style="padding:48px 40px;font-family:Helvetica,Arial,sans-serif;color:#1f1f23;">
<h1 style="margin:0 0 12px;font-size:28px;line-height:34px;font-weight:bold;">Dark mode is here</h1>
<p style="margin:0 0 28px;font-size:16px;line-height:24px;color:#3f3f46;">Hi {{first_name}}, YourApp now has a dark theme. It follows your system setting by default, and you can switch it any time from Preferences.</p>
<table role="presentation" cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolor="#1f1f23" style="border-radius:6px;">
<a href="https://yourapp.com/settings/appearance" style="display:inline-block;padding:12px 22px;font-family:Helvetica,Arial,sans-serif;font-size:15px;font-weight:bold;color:#ffffff;text-decoration:none;border-radius:6px;">Try dark mode</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p style="margin:24px 0 0;font-family:Helvetica,Arial,sans-serif;font-size:12px;line-height:18px;color:#71717a;">
<a href="{{unsubscribe_url}}" style="color:#71717a;">Unsubscribe</a>
</p>
</td>
</tr>
</table>
</body>
</html>3. Re-engagement
For users who haven't logged in for a while. Lead with what changed since they left, give one clear way back, and make leaving just as easy. A visible unsubscribe link costs you far less than a spam complaint.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>A lot has changed</title>
</head>
<body style="margin:0;padding:0;background:#f4f4f5;">
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="background:#f4f4f5;">
<tr>
<td align="center" style="padding:32px 16px;">
<table role="presentation" width="600" cellpadding="0" cellspacing="0" border="0" style="width:100%;max-width:600px;background:#ffffff;">
<tr>
<td style="padding:40px;font-family:Helvetica,Arial,sans-serif;font-size:16px;line-height:24px;color:#1f1f23;">
<p style="margin:0 0 16px;">Hi {{first_name}},</p>
<p style="margin:0 0 16px;">It's been a while since you used YourApp. Here's what's new since then:</p>
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="margin:0 0 24px;">
<tr><td style="padding:8px 0;border-top:1px solid #e4e4e7;">Projects load twice as fast</td></tr>
<tr><td style="padding:8px 0;border-top:1px solid #e4e4e7;">Invite your team with roles and permissions</td></tr>
<tr><td style="padding:8px 0;border-top:1px solid #e4e4e7;border-bottom:1px solid #e4e4e7;">Dark mode</td></tr>
</table>
<table role="presentation" cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolor="#1f1f23" style="border-radius:6px;">
<a href="https://yourapp.com/login" style="display:inline-block;padding:12px 22px;font-family:Helvetica,Arial,sans-serif;font-size:15px;font-weight:bold;color:#ffffff;text-decoration:none;border-radius:6px;">Pick up where you left off</a>
</td>
</tr>
</table>
<p style="margin:28px 0 0;font-size:14px;line-height:21px;color:#52525b;">Not using YourApp anymore? <a href="{{unsubscribe_url}}" style="color:#52525b;">Stop these emails</a> and we won't write again.</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>Notes on email HTML
Why tables instead of divs
Outlook for Windows renders email with Microsoft Word's engine, which ignores most modern CSS layout. Flexbox and grid don't exist there, and margins and widths on divs are unreliable. Tables are the one layout primitive every client agrees on. Add role="presentation" so screen readers don't announce them as data tables.
Inline styles only
Some clients strip <style> blocks entirely, and others support them only partly. Styles written inline on each element are the only approach that survives everywhere. Write your template with a stylesheet if you like, then run it through an inliner before sending.
CSS to avoid
| Property | Problem | Use instead |
|---|---|---|
| display: flex / grid | Ignored by Outlook | Nested tables |
| margin on divs | Inconsistent, often ignored | padding on a td |
| max-width alone | Ignored by Outlook | A width attribute on the table, plus max-width |
| background-image | Needs VML hacks in Outlook | A solid background colour |
| position | Stripped by most clients | Table layout |
| Web fonts | Unsupported in Outlook and Gmail | A system font stack |
| border-radius | Square corners in Outlook | Accept square corners there |
Before sending to your full list, send a test to yourself on Gmail, Outlook, and Apple Mail, on desktop and phone. Five minutes of checking beats a broken email in ten thousand inboxes.
Email your Supabase users today
Connect your project and send your first campaign in about five minutes. Free up to 500 recipients a month.