HTML technical guidelines
Specifications for a successful email
If you want to create a newsletter or an email campaign directly in HTML, it is useful to know the specifications that are required to ensure content displays correctly on most mail clients and services (Outlook, Gmail, and similar) and devices.
These specifications are based on the many years of experience that Contactlab staff have gained, together with the countless number of deliveries our clients have sent.
Objective
Here, you can learn high-quality HTML technical specifications that can be used with the Contactlab Marketing Cloud Send module.
General rule
An email’s HTML code must be more ‘simple and clean’ than that of a website page. Webmail services and mail clients have difficulty managing certain elements, such as style sheets, JavaScript and similar, when compared with a browser.
The following specifications also highlight the items that should NOT be included in a message, to help avoid recipient visualization problems.
What is important for you to know
The following sections describe the main technical requirements for creating HTML emails that display correctly across different email clients and devices.
They cover the recommended structure, HTML elements, styles, images, links, message size, and elements to avoid.
Content layout
All message content must be inserted into a fixed-width table, specifying the width in the width attribute of the <table> tag. For each cell, you must specify the width (e.g., <td width="121">).
Recommended width
While the table described in Contents layout must have a fixed width, there is no real maximum size. However, it is better not to exceed 600 – 650px, to avoid tedious horizontal scrolls for the recipient.
Recommended length
There is no recommended length. However, for newsletters or marketing emails to be effective, you need to ensure that messages are not too long. As much content detail as practically possible should be included in web pages, with the appropriate links contained in the message.
Doctype
To ensure that the HTML of the newsletter is correctly interpreted, use the following doctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<title> tag in the <head>
Insert text in the <title> tag. Avoid leaving the default text assigned by the HTML editor (e.g., "Untitled1" or "New Page 1"). It’s better if it matches the subject of the email.
Bugfix in the head
To ensure correct display and avoid text resizing on mobile devices or Outlook due to zoom, include the following code in the head tag:
<!–[if gte mso 9]>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
<![endif]–>
<style type="text/css">@-ms-viewport\{width:device-width}\</style>
<style type="text/css">
html { -webkit-text-size-adjust:none;}
body, .ReadMsgBody, .ExternalClass, .multi-col .column {width: 100%; width:100% !important; margin: 0px !important; padding: 0px; display: block; -ms-overflow-style: none !important;}
.ExternalClass {line-height: 100%;}
table, tr, td {margin:0; padding: 0; border-collapse: collapse !important; mso-line-height-alt:0px; mso-margin-top-alt:0px; mso-table-lspace:0px; mso-table-rspace:0px; vertical-align: top; border-spacing: 0; }
td { font-size:0px; line-height: 0px; }
a img, img{margin: 0px; padding: 0px; display: block;}
</style>
Meta tags
To ensure characters display correctly, including those in any online version, and to add information to any social shares on Facebook, include the following meta in the <head> tag:
<meta http-equiv="content-type" content="text/html; charset=UTF-8″>
<meta property="og:title" content="TITOLO" />
<meta property="og:description" content="DESCRIZIONE" />
<meta property="og:image" content="URL IMMAGINE" />