Html mail template code
Here is an example of a basic HTML email template code:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Email Template</title>
<style>
/* Add some basic styling to make the email look decent */
body {
font-family: Arial, sans-serif;
font-size: 16px;
line-height: 1.5;
padding: 0;
margin: 0;
}
img {
max-width: 100%;
height: auto;
display: block;
margin: 0 auto;
}
</style>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<table width="600" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<h1>Subject: {{ subject }}</h1>
<p>Dear {{ name }},</p>
<p>This is a test email.</p>
<p>Best regards,</p>
<p>{{ sender }}</p>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<a href="{{ link }}" target="_blank">
<img src="{{ image }}" alt="Image" width="100" height="100">
</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
This template uses a basic table structure to layout the email, with a centered header and a main content area. The {{ }}
placeholders are for dynamic content that will be replaced with actual values when the email is sent.
You can customize this template to fit your specific needs by adding or removing elements, and by modifying the CSS styles to match your brand's visual identity.
Some common elements you may want to include in your email template are:
- A header with a logo and a subject line
- A greeting and introduction
- A main content area with text, images, and links
- A call-to-action (CTA) button or link
- A footer with contact information and a unsubscribe link
- A responsive design that adapts to different email clients and devices
Keep in mind that email clients and devices can have different rendering capabilities, so it's a good idea to test your email template in different environments to ensure it looks and functions as expected.