“Email Builder” is a sophisticated web application for creating professional email templates with real-time preview capabilities. The application combines a comprehensive form-based editor with dual-mode preview functionality (iPhone and Outlook), generating production-ready HTML email templates with cross-client compatibility, mobile responsiveness, and professional design standards.
mailgen/
├── index.html # Complete email builder application (1,091 lines)
├── lion.png # Logo asset (referenced but not analyzed)
├── calendar-icon.png # Calendar icon asset (referenced but not analyzed)
└── location-icon.png # Location icon asset (referenced but not analyzed)
<!-- MSO (Microsoft Outlook) conditional comments -->
<!--[if mso]>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
<![endif]-->
<!-- Multi-client table structure -->
<!--[if gte mso 16]>
<table width="100%" align="center" bgcolor="#ffffff" cellspacing="0" cellpadding="0" border="0" role="presentation">
<tr><td width="100%" valign="top">
<![endif]-->
/* Core email compatibility styles */
html, body {
width: 100% !important;
margin: 0 auto !important;
padding: 0 !important;
}
table {
border-collapse: collapse !important;
border-spacing: 0;
}
table, td {
mso-table-lspace: 0pt; /* Outlook spacing fix */
mso-table-rspace: 0pt;
}
img {
-ms-interpolation-mode: bicubic; /* IE image rendering */
display: block;
border: none;
}
/* Disable automatic link detection on iOS */
*[x-apple-data-detectors],
.unstyle-auto-detected-links *,
.aBn {
cursor: default !important;
color: inherit !important;
text-decoration: none !important;
font-size: inherit !important;
font-family: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
}
/* iPhone frame styling */
.device-frame.iphone {
width: 300px;
height: 650px;
background: #1d1d1f; /* iPhone bezel color */
border-radius: 28px; /* iPhone X-style corners */
padding: 4px;
box-shadow: 0 0 0 1px #333, 0 8px 32px rgba(0, 0, 0, 0.4);
}
/* Outlook frame styling */
.device-frame.outlook {
width: 70vw;
max-width: 900px;
height: 600px;
background: #fff;
border-radius: 8px;
border: 1px solid rgba(56, 56, 56, 0.12);
box-shadow: 0 8px 32px rgba(0, 109, 228, 0.1);
}
function switchPreviewMode(mode) {
// Update device frame class
deviceFrame.className = `device-frame ${mode}`;
// Update active option styling
previewOptions.forEach(option => {
option.classList.remove('active');
if (option.dataset.mode === mode) {
option.classList.add('active');
}
});
// Refresh preview with new sizing and mobile styles
updatePreview();
}
The application generates professional HTML emails with comprehensive responsive features:
// Dynamic sizing based on preview mode
const imageWidth = currentMode === 'iphone' ? '280' : '568';
const titleSize = currentMode === 'iphone' ? '32px' : '42px';
const subtitleSize = currentMode === 'iphone' ? '16px' : '18px';
const iconSize = currentMode === 'iphone' ? '12' : '16';
<!-- Custom web font integration -->
<style>
@font-face {
font-family: 'Lora';
src: url('https://fonts.cleverbox.co.uk/lora/font-500.woff2') format('woff2');
font-weight: 500;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Poppins';
src: url('https://fonts.cleverbox.co.uk/poppins/font-400.woff2') format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
}
</style>
:root {
--text-primary: #1A2238; /* Dark blue for headlines */
--text-secondary: #666666; /* Gray for body text */
--background: #ffffff; /* Clean white background */
}
/* Professional typography styling */
h1 {
font-family: 'Lora', Georgia, 'Times New Roman', Times, serif;
font-weight: 500;
color: #1A2238;
letter-spacing: -0.5px; /* Modern tight letter spacing */
}
p {
font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
font-weight: 400;
color: #666666;
}
// Form input elements with real-time preview updates
const titleInput = document.getElementById("titleInput");
const dateInput = document.getElementById("dateInput");
const locationInput = document.getElementById("locationInput");
const subtitleInput = document.getElementById("subtitleInput");
const imageInput = document.getElementById("imageInput");
// Real-time preview updates
titleInput.addEventListener("input", updatePreview);
dateInput.addEventListener("input", updatePreview);
locationInput.addEventListener("input", updatePreview);
subtitleInput.addEventListener("input", updatePreview);
imageInput.addEventListener("input", updatePreview);
function clearPlaceholder(input, placeholder) {
if (input.value === placeholder) {
input.value = '';
input.style.color = '#383838'; /* Active text color */
}
}
function restorePlaceholder(input, placeholder) {
if (input.value === '') {
input.value = placeholder;
input.style.color = 'rgba(56, 56, 56, 0.5)'; /* Placeholder color */
}
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background: #FFFFFD; /* Warm white background */
color: #383838; /* Soft black text */
display: flex;
height: 100vh;
overflow: hidden;
}
.sidebar {
width: 380px;
background: linear-gradient(135deg, #FFFFFD 0%, #f8f9fa 100%);
box-shadow: 2px 0 20px rgba(0, 109, 228, 0.06);
border-right: 1px solid rgba(56, 56, 56, 0.08);
}
input, textarea {
width: 100%;
padding: 16px 20px;
font-size: 15px;
border: 2px solid rgba(56, 56, 56, 0.08);
border-radius: 50px; /* Rounded modern inputs */
background: #FFFFFD;
transition: all 0.2s ease;
}
input:focus, textarea:focus {
outline: none;
border-color: #006DE4; /* Blue focus state */
box-shadow: 0 0 0 3px rgba(0, 109, 228, 0.1);
transform: translateY(-1px); /* Subtle lift effect */
}
button {
padding: 16px 32px;
font-size: 15px;
font-weight: 600;
background: linear-gradient(135deg, #FFCC02 0%, #FFD93D 100%); /* Gold gradient */
color: #383838;
border: none;
border-radius: 50px;
cursor: pointer;
transition: all 0.2s ease;
box-shadow: 0 4px 12px rgba(255, 204, 2, 0.3);
letter-spacing: 0.3px;
text-transform: uppercase;
}
button:hover {
transform: translateY(-2px); /* Enhanced lift on hover */
box-shadow: 0 8px 25px rgba(255, 204, 2, 0.4);
background: linear-gradient(135deg, #FFD93D 0%, #FFCC02 100%);
}
<!-- Logo and branding section -->
<table width="100%" align="center" bgcolor="#ffffff" cellspacing="0" cellpadding="0" border="0" role="presentation">
<tr>
<td class="mobile-padding mobile-header-padding" style="padding:32px 24px 8px 24px;" valign="top">
<table width="100%" cellspacing="0" cellpadding="0" border="0" role="presentation">
<tr>
<td align="center" style="padding-bottom:0px;">
<img src="https://joshbruce.online/mailgen/lion.png"
width="80"
height="54"
alt="Logo"
style="display:block; width:80px; height:54px; margin:0 auto;">
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- Main content with responsive typography -->
<h1 class="mobile-title" style="margin:0; font-family:'Lora', Georgia, 'Times New Roman', Times, serif; font-size:${titleSize}; font-weight:500; color:#1A2238; line-height:${titleLineHeight}; letter-spacing:-0.5px;">
${title}
</h1>
<p class="mobile-subtitle" style="margin:0; font-family:'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; font-size:${subtitleSize}; font-weight:400; color:#666666; line-height:${subtitleLineHeight};">
${subtitle}
</p>
<!-- Icon-based event information -->
<table align="center" cellspacing="0" cellpadding="0" border="0" role="presentation" style="margin:0 auto;">
<tr>
<td style="padding-right:12px; vertical-align:middle;">
<table cellspacing="0" cellpadding="0" border="0" role="presentation">
<tr>
<td style="padding-right:6px; vertical-align:middle;">
<img src="https://joshbruce.online/mailgen/calendar-icon.png"
width="${iconSize}"
height="${iconSize}"
alt="Calendar"
style="display:inline-block; width:${iconSize}px; height:${iconSize}px; vertical-align:middle;">
</td>
<td style="vertical-align:middle;">
<span style="font-family:'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; font-size:${infoTextSize}; font-weight:400; color:#1A2238; line-height:${infoLineHeight};">${date}</span>
</td>
</tr>
</table>
</td>
</tr>
</table>
/* Comprehensive mobile responsive styles */
@media only screen and (max-width: 480px) {
.container {
width: 100% !important;
max-width: 100% !important;
}
.mobile-padding {
padding: 16px !important;
}
.mobile-img {
width: 100% !important;
height: auto !important;
}
.mobile-title {
font-size: 24px !important;
line-height: 30px !important;
}
.mobile-subtitle {
font-size: 16px !important;
line-height: 22px !important;
}
}
/* Enhanced mobile simulation for iPhone preview */
.force-mobile .mobile-title {
font-size: 32px !important;
line-height: 38px !important;
}
.force-mobile .mobile-header-padding {
padding: 32px 16px 8px 16px !important;
}
.force-mobile .mobile-content-padding {
padding: 0 16px 16px 16px !important;
}
function generateHTML() {
const title = titleInput.value;
const date = dateInput.value;
const location = locationInput.value;
const subtitle = subtitleInput.value;
const imageUrl = imageInput.value;
// Generate desktop-optimized universal email HTML
const imageWidth = '362'; // Optimal desktop width
const titleSize = '42px'; // Desktop headline size
const subtitleSize = '18px'; // Desktop body text size
return `<!DOCTYPE html>...`; // Complete email template
}
function downloadHTML() {
const html = generateHTML();
const title = titleInput.value || "email-template";
// Clean the title to make it filename-safe
const cleanTitle = title.replace(/[^a-z0-9]/gi, '-').toLowerCase();
// Create and trigger download
const blob = new Blob([html], { type: "text/html" });
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.download = `${cleanTitle}.html`;
link.click();
URL.revokeObjectURL(url);
}
function updatePreview() {
const html = generatePreviewHTML();
const doc = previewFrame.contentDocument || previewFrame.contentWindow.document;
doc.open();
doc.write(html);
doc.close();
// Apply mobile styles if iPhone mode is selected
const isMobile = deviceFrame.classList.contains('iphone');
if (isMobile) {
setTimeout(() => {
const body = doc.body;
if (body) {
body.classList.add('force-mobile');
}
}, 100);
}
}
function generatePreviewHTML() {
const currentMode = deviceFrame.classList.contains('iphone') ? 'iphone' : 'outlook';
// Preview-specific sizing (changes based on preview mode)
const imageWidth = currentMode === 'iphone' ? '280' : '568';
const titleSize = currentMode === 'iphone' ? '32px' : '42px';
const subtitleSize = currentMode === 'iphone' ? '16px' : '18px';
return generateTemplateWithParameters(imageWidth, titleSize, subtitleSize);
}
// Efficient DOM updates
function updatePreview() {
// Generate HTML once
const html = generatePreviewHTML();
// Direct document write for performance
const doc = previewFrame.contentDocument || previewFrame.contentWindow.document;
doc.open();
doc.write(html);
doc.close();
}
Email Builder represents a sophisticated solution for professional email template creation that successfully combines modern web development with email industry standards. The comprehensive cross-client compatibility, dual-mode preview system, and professional design output create an invaluable tool for marketing professionals, event organizers, and anyone requiring high-quality email communications.
Technical Rating: 9.1/10
The application successfully bridges the gap between modern web development practices and the restrictive world of email client compatibility, providing users with professional-grade email template creation tools that produce reliable, cross-platform results.