Recommendations and Best Practices for formatting Email Bodies with HTML

Email messages sent from Twilio SendGrid are capable of using HTML for styling and formatting of the message body. This guide covers our recommended best practices for using HTML email body styling.

Duplicate versions

Ensure your email contains both plain text and HTML versions, so recipients can view your message using the mail client of their choice. If you only send HTML emails, and a recipient's server or mail client blocks HTML content, they will not see anything in your emails.

Character limits

Make sure that your email body does not exceed the following limitations:

Each line maximum of 78 characters in length
Continuous characters maximum of 998 characters

These limitations are called out in the official Internet Message Format spec (RFC 5322), section 2.1.1 - Line Length Limits.

Content-transfer-encoding MIME values

Twilio Sendgrid's API and Template Engine does not allow for changing the Content-Transfer-Encoding header. Setting the the Content-Transfer-Encoding header is only possible when sending SMTP messages.

 

Twilio SendGrid recommends to not use the quoted-printable MIME value for content-transfer-encoding to help resolve any issues with the presentation of your email messages in common mail clients. When this value is used, the following issues may be seen:

  • Some mail clients (such as Outlook and Thunderbird) appear to insert double spacing line breaks at every line. The reason is that the content-transfer-encoding value in MIME is set to quoted-printable which adds Carriage Return Line Feed (CRLF) line breaks to the source content of the email. To alleviate this problem, please do the following:
    • If you can customize the MIME settings for your email, set the Content-Transfer-Encoding value to 7bit.
    • Ensure that your content follows the line length limits.
  • The quoted-printable value may also cause hard line breaks to appear as CRLF characters in the source of an email with the character combination of =0D in the source. This only happens with 'quoted-printable' (Content-Transfer-Encoding set in MIME) emails.
Have more questions? Submit a request