Best practices for using comments in publicly viewable email HTML code center on their utility as internal developer notes and their distinct role in conditional statements for specific email clients. Most email clients and ESPs strip general HTML comments, rendering them invisible to recipients and typically having no impact on deliverability or rendering. However, conditional comments remain vital for targeting Outlook desktop clients, which utilize an older rendering engine. Experts recommend minimal use of comments in production code, highlighting potential security risks if sensitive information is included and not stripped. There is also a call for email development to adopt more rigorous software engineering practices, such as minification and source control, to manage comments and optimize code efficiently, ensuring comments serve their purpose without unnecessarily contributing to code bloat or visibility issues.
12 marketer opinions
For publicly viewable email HTML, the consensus among experts is to minimize or entirely strip comments in production environments. While HTML comments offer significant value for internal developer notes, code organization, and debugging, most email clients and Email Service Providers (ESPs) remove them before delivery, making them generally invisible to recipients and without impact on deliverability. A notable exception involves conditional comments, which remain essential for ensuring proper rendering on specific Outlook desktop clients. Security concerns arise if sensitive data is embedded within comments that are not reliably stripped. The evolving landscape of email development calls for more structured software engineering practices, such as code minification and version control, to manage comments internally and optimize the final code for deployment.
Marketer view
Marketer from Email Geeks explains that publicly viewed code, including email HTML, should contain minimal to no comments in production environments. He emphasizes that comments can pose security risks, such as exposing sensitive information, and that proper coding standards with change control should handle documentation internally, with comments ideally stripped out before deployment to production. He also notes the evolution of email into a specialized ecosystem with more defined roles.
5 Feb 2024 - Email Geeks
Marketer view
Marketer from Email Geeks agrees that comments should generally be absent from public HTML code, especially without a compiler, but suggests an exception for explaining the 'why' behind specific code decisions. He highlights that email development could benefit from adopting software development processes like minification, stripping comments and whitespace, and source control. He attributes the lack of these practices to email developers often not having traditional computer science backgrounds, instead learning on the job. He advocates for more structured tools and processes to manage email code, recognizing the constant changes in email client support and the absence of a W3C-like standard for email, which makes it challenging.
26 Mar 2024 - Email Geeks
0 expert opinions
For optimal email deliverability and recipient experience, the best practice for publicly viewable HTML code is to minimize or entirely remove general comments in the final production version. While valuable for internal developer documentation, code clarity, and debugging, most email clients and Email Service Providers (ESPs) automatically strip these comments, rendering them invisible and without impact on deliverability. A crucial exception applies to conditional comments, which remain essential for precise rendering across various Outlook desktop clients. To prevent the accidental exposure of sensitive data and to ensure lean code, leveraging modern software development practices like minification and version control to manage comments internally is highly recommended.
5 technical articles
HTML comments in email code primarily serve as internal annotations for developers, aiding in documentation, clarity, and debugging. While most email clients and Email Service Providers (ESPs) remove these general comments before delivery, making them effectively invisible to recipients and without impact on deliverability, a critical exception exists. Conditional comments are indispensable for ensuring proper rendering across specific Outlook desktop clients, which rely on older rendering engines like Internet Explorer. Experts emphasize that general comments should be considered safe for internal notes, though a minor risk of visibility exists in some less common desktop environments, especially if sensitive information is included. Therefore, the best practice for production email HTML involves either minimizing general comments or using build processes to strip them, reserving functional comments strictly for conditional logic aimed at specific client compatibility.
Technical article
Documentation from learn.microsoft.com explains that conditional comments are a specific type of HTML comment used to target different versions of Internet Explorer, which is relevant for email developers because Outlook desktop clients often use IE's rendering engine, allowing for targeted styling or code for these specific email environments.
23 Feb 2024 - learn.microsoft.com
Technical article
Documentation from Email on Acid explains that HTML comments serve as valuable internal notes for developers and are useful for debugging during the email development process, though most email clients remove them before rendering; however, conditional comments remain crucial for ensuring proper display in Outlook.
30 Aug 2022 - Email on Acid
Does a broken link in a commented out section of an email affect deliverability?
How does HTML coding affect email deliverability and are emojis safe to use in email marketing?
What are the best practices for embedding vCard links in welcome emails?
What are the best practices for linking to PDFs in email marketing?
What are the best practices for sending legally mandated email notifications?
What are the risks and best practices for using mailto links in marketing emails?