HTML Renders Unexpectedly When Viewed from Email "Preview HTML Body" and "Notification Preview"Description<!-- div.margin { padding: 10px 40px 40px 30px; } table.tocTable { border: 1px solid; border-color: #e0e0e0; background-color: #fff; } .title { color: #d1232b; font-weight: normal; font-size: 28px; } h1 { color: #d1232b; font-weight: normal; font-size: 21px; margin-bottom: 5px; border-bottom-width: 2px; border-bottom-style: solid; border-bottom-color: #cccccc; } h2 { color: #646464; font-weight: bold; font-size: 18px; } h3 { color: #000000; font-weight: bold; font-size: 16px; } h4 { color: #666666; font-weight: bold; font-size: 15px; } h5 { color: #000000; font-weight: bold; font-size: 13px; } h6 { color: #000000; font-weight: bold; font-size:14px; } ul, ol { margin-left: 0; list-style-position: outside; } --> Symptoms HTML renders unexpectedly when viewed from the platform email tools "Preview HTML Body” and "Notification Preview”. For example these views may have unexpected fonts. Note that the HTML looks "normal" when an email is viewed from an email client and also in a record's Activity trail. Release Applies to any release. Cause The ServiceNow platform is sanitizing the HTML when using the "Preview HTML Body” and "Notification Preview” email functions. Resolution This will happen if the HTML is invalid (although browsers and email clients may allow the invalid HTML). We allow customers full control over HTML, so there is no sanitation when the emails are sent out or displayed in the Activity trail of records. The sanitation process is fixing the invalid HTML and making it look bad when rendered. To see the difference between sanitized and un-sanitized HTML, you can run a script to output the sanitized version of an email record from Scripts - Background: var gr1 = new GlideRecord('sys_email'); gr1.get('<email sys_id>'); gs.print(SNC.GlideHTMLSanitizer.sanitize(gr1.body)); The output can be saved to a .html file and viewed in a browser. This includes any customer created HTML in email notifications, email templates, or email scripts. For example this is an email script that uses the deprecated font tag: (function runMailScript(current, template, email, email_action, event) { template.print("<font size='2' face='tahoma,arial,helvetica,sans-serif'>"); })(current, template, email, email_action, event); The font tag is deprecated and should not be used. CSS should be used to style the font instead. This is just one example of invalid HTML, it is the responsibility of the creators of the HTML to be sure that the HTML is valid and conforming to HTML specifications.