HTML best practice
Tips for a successful email
The following sections provide practical guidelines for creating effective and compatible HTML emails.
They cover image management, responsive design, mobile optimization, technical limitations, and the importance of testing an email before sending it.
Embedded images
Normally, images in an HTML email are hosted on an external server and loaded when the recipient opens the message. As an alternative to this standard procedure, images can be embedded directly in the message. In this case, they are already included in the email and are not loaded from the external server.
Advantages and disadvantages
The main reason for embedding images in an email is to prevent them from being blocked, as most email clients and webmail services implement image blocking. Embedding the images allows the message to be displayed immediately with all visual elements in place.
However, embedded images increase the risk of the message being classified as spam because they increase the email file size. The size of the images is added to the size of the HTML.
The email tracking image used to record email openings cannot be embedded because it is inserted automatically by the system.
How to Proceed in Send
- Start with standard HTML in which the images are loaded from an external server, for example:
<img src="http://server.it/img/photo.jpg">. - Edit the image tags manually by entering the image URL using the following syntax:
@(http://Image_URL)@. - After modifying all the tags as described in step 2, save the edited HTML on the computer.
- Open the platform and go to Send > Create > New Campaign > (group name) > Message Content.
- In the message content screen, upload the edited HTML file using the Upload from: a file on my computer button, or paste the code directly into the text area.
- The edited HTML is loaded into Send. Complete the campaign creation process by selecting Next. The images are included in the
<body>of the message. - Run a test to ensure that the embedded images are displayed correctly.
If the paths in the <img> tags are not modified using the @(http://…)@ syntax, no error is generated. However, the images are still loaded from the server where they are hosted when the email is opened and may therefore be blocked by the image-blocking settings of the email client or webmail service.
How to create a responsive email
There are several techniques for developing a responsive email:
- With a fluid layout, by declaring table values as percentages or using
max-widthandmin-width; - With an adaptive layout, by developing custom HTML so that the structure adapts to the viewport, for example, by stacking boxes;
- By declaring CSS: media queries allow styles and sizes to change according to the display size on which the newsletter is viewed.
Each technique has support limitations depending on the email client, app, or device. The appropriate technique should be selected according to the layout. The following are some basic guidelines.
-
Add the following code to the
<head>:<meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, minimum-scale=1.0, user-scalable=no" /><meta http-equiv="content-type" content="text/html; charset=UTF-8"><meta name="x-apple-disable-message-reformatting"> -
Declare the media queries in the style as follows:
@media screen and (max-device-width: 568px), screen and (max-width: 568px) { CSS* } -
In this example, 568 px is the maximum viewport width at which the CSS styles are applied. Declare the classes used in the HTML for mobile display.
For example, to hide content on mobile, use the following class:
.onlydesktop {display:none !important; width:0 !important;} -
Use conditional comments such as
[if mso]to ensure correct display in Outlook. For example:<!--[if mso]></td><td style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;vertical-align:top;"><![endif]--> -
Add the following to each
<td>tag to prevent additional spacing:style="padding: 0px; vertical-align:top;"
Don't forget mobile optimization
Mobile devices are among the most frequently used communication channels, not only for SMS and instant messaging but also for receiving emails. Ensuring that communications are displayed correctly, maintain the appearance defined during the design phase, and meet a high quality standard is essential.
To develop a layout suitable for mobile devices, consider the structure from a “mobile first” perspective and follow these guidelines:
- Text should be larger than 14 px.
- Buttons for touch devices should be large, at least 40 px high.
- Leave a space of at least 10 or 15 px between clickable elements.
- Use images at twice the standard size with the same proportions to ensure correct rendering on Retina and HD displays.
- Fixed elements should not be taller than 320 px.
- Remove low-priority, large, or unusable content.
- Use strong contrast for the elements.
Non-negotiable limits
The guidelines above help ensure correct display in most webmail services and email programs currently in use. However, some limitations depend on the policies of individual providers or software manufacturers and cannot be resolved.
For example, display problems are frequently reported with email programs in the Lotus suite.
Test before sending
The best way to check that an email is displayed correctly and that all its elements work properly is still to send a test before the actual delivery.
Send allows a test filter to be created for each database, as described in Configure > User DB, and a test delivery to be sent, as described in Create > Email Campaign.
It is recommended to include different addresses in the test and check the message using different email programs and webmail services.
As described above, several measures can be taken to create emails that are displayed correctly and engage recipients. Following these guidelines helps create high-quality emails that are displayed as intended in different browsers and are easy to read.