How to format messages according to RFC 5322 for Gmail sender guidelines?

Summary

To properly format messages according to RFC 5322 for Gmail sender guidelines, a multifaceted approach is necessary. Key elements include adherence to line length limits, correct formatting of essential headers, and avoiding common errors like incorrect content types or invalid character encodings. Proper MIME encoding (UTF-8) is critical, as is implementing DKIM and SPF for email authentication. While most ESPs handle the underlying RFC 5322 formatting, focusing on high-quality content, ethical address acquisition, and deliverability monitoring is essential. Ensuring the 'From' header is accurate, handling bounces appropriately, and using simplified HTML layouts all contribute to improved deliverability and compliance. Testing across various email clients is also crucial to ensure consistent rendering. It is also important to note that while JWT (RFC 7519) is useful for security between parties, its relevance to RFC 5322 is limited.

Key findings

  • RFC 5322 Basics: RFC 5322 defines the structure of email messages, including headers and body.
  • Essential Headers: Proper formatting of 'From', 'To', 'Subject', 'Date', and 'MIME-Version' headers is crucial.
  • Line Length Limits: RFC 5322 mandates a maximum line length of 998 characters (excluding CRLF).
  • MIME and Encoding: Correct MIME encoding, particularly using UTF-8, ensures proper character display.
  • Authentication (SPF/DKIM): Implementing SPF and DKIM is vital for verifying sender identity and improving deliverability.
  • TNEF Consideration: Microsoft’s TNEF format may cause compatibility issues with non-Microsoft clients.
  • Key to Good Deliverability: Address acquisition, content quality and authentication are key to good deliverability.

Key considerations

  • ESP Responsibility: While ESPs generally handle RFC formatting, marketers should ensure compliance.
  • Content Quality: Focus on creating engaging, valuable content to improve engagement and deliverability.
  • Address Acquisition: Employ ethical address acquisition practices to maintain a healthy mailing list.
  • Authentication Implementation: Set up SPF and DKIM correctly to authenticate your emails and prevent spoofing.
  • HTML Simplification: Simplify HTML layouts and avoid excessive code to improve rendering and reduce spam triggers.
  • Deliverability Monitoring: Regularly monitor deliverability metrics to identify and address issues promptly.
  • Testing Across Clients: Test emails across different email clients and devices to ensure consistent rendering.

What email marketers say
10Marketer opinions

To format messages according to RFC 5322 for Gmail sender guidelines, email marketers should focus on several key areas. These include adhering to line length limits (998 characters max), correctly formatting essential headers (From, To, Subject, Date, MIME-Version), and avoiding common formatting errors (missing Content-Type, invalid character encodings, improper MIME boundaries). Proper MIME encoding with UTF-8 is crucial, as is email authentication using DKIM and SPF. Regular deliverability monitoring, simplified HTML layouts, and thorough testing across email clients are also essential for compliance and optimal rendering.

Key opinions

  • Line Length Limits: RFC 5322 specifies a maximum line length of 998 characters, excluding the trailing CRLF. Exceeding this limit requires line folding.
  • Essential Headers: Correctly formatting essential email headers (From, To, Subject, Date, MIME-Version) is crucial for deliverability.
  • Common Formatting Errors: Avoid missing or incorrect Content-Type headers, invalid character encodings, and improper use of MIME boundaries.
  • MIME Encoding: Proper MIME encoding with UTF-8 is essential for correct character display across email clients.
  • Email Authentication: Implement DKIM and SPF for email authentication to verify sender identity and improve deliverability.
  • Deliverability Monitoring: Regularly monitor email deliverability using tools that provide insights into inbox placement and spam folder placement.
  • HTML Layouts: Avoid excessive HTML code and overly complex layouts to improve rendering and reduce formatting issues.
  • Testing: Test email formatting and rendering across different email clients to ensure correct display and RFC 5322 compliance.

Key considerations

  • Adherence to RFC 5322: Strict adherence to RFC 5322 is essential for compliance with Gmail sender guidelines and maintaining optimal deliverability.
  • Character Encoding: Using valid character encoding (UTF-8) ensures that all characters in your email are displayed correctly across different clients.
  • Header Accuracy: Ensuring that all essential headers (From, To, Subject, Date, MIME-Version) are correctly formatted improves deliverability.
  • Layout Simplicity: Simplifying HTML layouts and avoiding excessive code can reduce rendering issues and improve compliance.
  • Authentication Implementation: Proper implementation of DKIM and SPF is necessary to verify sender identity and improve deliverability.
  • Continuous Monitoring: Regularly monitoring email deliverability and testing across clients helps identify and address any formatting or compliance issues.
Marketer view

Email marketer from Reddit shares to avoid common formatting errors such as missing or incorrect Content-Type headers, invalid character encodings, and improper use of MIME boundaries. These errors can lead to deliverability issues and non-compliance with RFC 5322.

January 2025 - Reddit
Marketer view

Email marketer from Litmus explains that the MIME-Version header is crucial for indicating that the message conforms to MIME standards. The Content-Type header specifies the type of data in the message body (e.g., text/plain, text/html) and must be correctly set to ensure proper rendering.

March 2022 - Litmus
Marketer view

Email marketer from Mailjet explains that essential email headers include From (sender's address), To (recipient's address), Subject, Date, and MIME-Version. Correctly formatting these headers is crucial for deliverability and compliance with RFC 5322.

July 2023 - Mailjet
Marketer view

Email marketer from SparkPost suggests to implement DKIM (DomainKeys Identified Mail) and SPF (Sender Policy Framework) for email authentication. These mechanisms help verify the sender's identity and improve deliverability by complying with sender guidelines.

September 2024 - SparkPost
Marketer view

Email marketer from GlockApps explains that you should regularly monitor your email deliverability using tools that provide insights into inbox placement rates, spam folder placement, and authentication status. This helps identify and address any formatting or compliance issues that may be affecting deliverability.

October 2022 - GlockApps
Marketer view

Email marketer from Stack Overflow explains that RFC 5322 specifies a maximum line length of 998 characters, excluding the trailing CRLF. Lines exceeding this limit must be folded (split) to adhere to the standard.

November 2021 - Stack Overflow
Marketer view

Email marketer from Campaign Monitor explains that using valid character encoding (e.g., UTF-8) is essential for ensuring that all characters in your email are displayed correctly across different email clients and platforms. Incorrect encoding can lead to garbled text and formatting issues.

March 2021 - Campaign Monitor
Marketer view

Email marketer from Email Geeks shares to pay attention to line size limits, especially the one that says 998 characters max plus CR/LF. HTML tags that insert line breaks into content don't count as CR/LF; you have to actually physically press the return key every now and then

March 2022 - Email Geeks
Marketer view

Email marketer from Email on Acid shares that you need to use tools to test email formatting and rendering across different email clients. This helps ensure that your emails are displayed correctly and comply with RFC 5322 standards.

March 2025 - Email on Acid
Marketer view

Email marketer from SendGrid shares to avoid excessive HTML code and overly complex layouts in your email designs. Simplified, well-structured HTML improves rendering and reduces the likelihood of formatting issues that may violate RFC 5322.

December 2022 - SendGrid

What the experts say
8Expert opinions

When formatting messages according to RFC 5322 for Gmail sender guidelines, the primary focus for most email marketers should be on content, address acquisition practices, email authentication (SPF, DKIM, DMARC), and proper MIME encoding using UTF-8. ESPs generally handle RFC compliance, so unless you're a software developer or MTA expert, direct manipulation of message formatting is usually unnecessary. Avoid duplicating headers, ensure correct line endings, and don't encode unnecessarily. Correct bounce processing and an accurate 'From' header are also crucial. While some experts find certain ESPs, like SFMC, technically capable, poor deliverability often stems from address acquisition or content issues rather than RFC formatting errors.

Key opinions

  • Limited Direct Impact: For most marketers, direct manipulation of RFC 5322 formatting is unnecessary as ESPs handle it.
  • Key Formatting Aspects: Focus on avoiding duplicate headers, ensuring correct line endings, and proper MIME encoding using UTF-8.
  • Authentication is Critical: Proper email authentication (SPF, DKIM, DMARC) is vital for compliance and deliverability.
  • Content & Acquisition Matter More: Poor deliverability is more likely caused by address acquisition practices or content than RFC formatting issues.
  • Importance of 'From' Header: The 'From' header must accurately reflect the sender to avoid filtering and non-compliance.
  • Bounce Processing: Correct handling of bounces and feedback loops is important for sender reputation.

Key considerations

  • ESP Responsibility: Trust your ESP to handle low-level RFC formatting unless you are a developer working on an MTA.
  • Content Quality: Prioritize high-quality, engaging content and ethical address acquisition practices.
  • Authentication Setup: Implement SPF, DKIM, and DMARC to improve deliverability and sender reputation.
  • Header Accuracy: Ensure that the 'From' header accurately represents the sender and the domain.
  • Monitoring Bounces: Establish a system for processing bounce messages and removing invalid addresses from your lists.
Expert view

Expert from Email Geeks explains that generally, unless you're a MTA developer, you don't need to care about RFC 5322. But the tl;dr is: don't duplicate headers that shouldn't be duplicated (ie, no double to: from: or subject lines). Also: pay attention to your line endings and don't encode things that shouldn't be encoded.

December 2023 - Email Geeks
Expert view

Expert from Spam Resource explains that proper email authentication (SPF, DKIM, DMARC) is vital for compliance. It ensures that your emails are correctly identified and trusted by receiving mail servers, improving deliverability.

May 2023 - Spam Resource
Expert view

Expert from Email Geeks answers that unless you’re a software developer, just pour your content into your ESPs message composition window and it’s their problem. Like, you cannot as a user make email that violates the various RFCs via your ESP. If you manage to, it’s a bug the ESP needs to fix.

February 2022 - Email Geeks
Expert view

Expert from Email Geeks shares the MTA won’t typically fix up badly formatted mail. It breaks all the things if it tries. The buck stops with the MUA (which at the ESP is the message composition tool). Laura Atkins agrees.

March 2021 - Email Geeks
Expert view

Expert from Word to the Wise explains that handling bounces and feedback loops correctly is crucial. Properly processing bounce messages helps you maintain a clean sending reputation and ensures that you comply with sender guidelines by removing invalid addresses.

November 2021 - Word to the Wise
Expert view

Expert from Spam Resource explains that proper MIME encoding for email content is necessary for compliance. Make sure the character encoding used is declared correctly, using UTF-8 to support a wide range of characters without issue.

January 2022 - Spam Resource
Expert view

Expert from Email Geeks answers that poor delivery will typically be caused by your address acquisition practices or your content. Steve thinks SFMC is a terrible ESP, but even they will be able to format email technically correctly most of the time. Laura Atkins agrees that RFC compliance will not cause poor delivery. Al Iverson states that RFC header compliance is not an issue for SFMC.

June 2021 - Email Geeks
Expert view

Expert from Word to the Wise explains that you should ensure the ‘From’ header accurately reflects the sender and is consistent with the domain’s reputation. A misleading 'From' address can result in filtering and non-compliance.

February 2022 - Word to the Wise

What the documentation says
5Technical articles

RFC 5322 dictates the structure of internet messages, comprising header fields (sender, recipient, subject, date) and an optional message body. Google mandates adherence to RFC 5322, including proper header formatting and MIME type declarations. Microsoft uses TNEF, a format for encapsulating MIME messages. DKIM provides a digital signature in the header to verify sender authenticity and message integrity. While JWT (RFC 7519) secures claims between parties, its relevance to basic RFC 5322 email formatting is limited.

Key findings

  • RFC 5322 Structure: RFC 5322 defines email structure with headers and an optional body.
  • Google Requirement: Google requires RFC 5322 compliance, including proper headers and MIME types.
  • Microsoft's TNEF: Microsoft uses TNEF for encapsulating MIME messages; compatibility may be a concern.
  • DKIM Signature: DKIM provides a digital signature to verify sender and message integrity.
  • JWT Security: JWT (RFC 7519) is used for securing claims but has limited direct impact on RFC 5322 formatting.

Key considerations

  • Header Compliance: Ensuring accurate header formatting (To, From, Subject, Date) is essential.
  • MIME Type Declaration: Proper MIME type declarations are critical for correct email content rendering.
  • TNEF Compatibility: Consider TNEF compatibility issues when sending to non-Microsoft email clients.
  • DKIM Implementation: Implement DKIM to enhance email authentication and trust.
  • Limited JWT Relevance: While important for security elsewhere, JWT has a limited direct role in RFC 5322 email formatting.
Technical article

Documentation from DKIM explains that a DKIM signature is a digital signature added to the header of an email message. The signature is used to verify that the message was sent by an authorized sender and has not been altered in transit. The DKIM signature consists of a hash of the message body and a hash of the message headers. The DKIM signature also includes the sender's domain name and the date and time the message was sent.

October 2023 - DKIM.org
Technical article

Documentation from Microsoft details that messages sent over the internet must be in the Transport Neutral Encapsulation Format (TNEF). TNEF is a Microsoft-specific email format for encapsulating MIME messages. Email clients that do not support TNEF may not be able to properly interpret the contents of the email.

September 2023 - Microsoft
Technical article

Documentation from Google Support details that messages must be formatted using the Internet Message Format standard (RFC 5322). This includes proper header formatting, such as To, From, and Subject, and correct MIME type declarations for email content.

April 2024 - Google Support
Technical article

Documentation from Auth0 details that Json Web Tokens (JWT) are an open, industry standard RFC 7519 method for representing claims securely between two parties. JWT's can be signed using a secret (with the HMAC algorithm) or a public/private key pair using RSA or ECDSA.

November 2023 - Auth0
Technical article

Documentation from ietf.org details that RFC 5322 specifies the Internet message format. Messages consist of header fields and, optionally, a message body. The header fields contain information such as sender, recipient, subject, and date.

November 2022 - ietf.org