About
Email body are mostly written in HTML for advanced format and design of document that goes from marketing document to conventional letter
An HTML email:
- integrates all style in one page (to be able to be read it offline)
- have no script (disabled by email client for security reason).
- uses absolute links for images
The HTML emails sends programmatically:
- are created via with a template with variable such as client name, text
- and optionally got their style inlined
There is also engine that does all of that at once.
Example
From amazon:
Text written by Gary Provost if we believe this page
HTML
Supported HTML Syntax
A well written HTML document is accepted nowadays in every modern email client (Gmail, ..) but not every tag is still supported.
HTML and CSS tag supports by client can be found at caniemail
For Gmail specifically: See css support and Gmail css reference
Metadata
You can add structured data such as reservation, meeting.
Best Practice
Best practices:
- 600-800 pixels maximum width
- basic font (Arial, Verdana, Georgia, and Times New Roman)
- image (no svg support)
- layout is almost done only with the table tag
More … see the design best practices at stackoverflow
Inline CSS
Because old email client may strip out the head and style tags from HTML emails, a process called inlineCss or premailer is generally executed in order to get all style inline.
Therefore there is always a pre-processing on HTML for email that will inline the CSS style.
Inline Library:
- Go: Online forms (code)
- Javascript: https://github.com/Automattic/juice
Template
An email template is a HTML template where variable (such as name, place, order, ..) are replaced with data before sending the email to create the the body of the email message.
For transactional email:
For batch email (marketing,..):
See also by categories
Repository:
No target on Anchor
In your email, it's best to add no target attribute on the anchor.
As target=“_blank”
- may open a popup: Papercut-SMTP
- don't let the choice to the user
Editor
Email editor are editor that target the HTML for the Email client.
List:
- Special Language to create email with online editor: https://mjml.io/ (https://github.com/mjmlio)
- Online Editor:https://react-email-editor-demo.netlify.app/ code
Engine
An engine is an application that takes as input:
- a template
- the data for the template placeholders (variable)
- create the email body
List:
- Javascript: https://github.com/eladnava/mailgen
Design Guide
- Stackoverflow has published its Email guideline
- There is also the Netiquette Guidelines over net communication