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; } --> HTML renders unexpectedly when viewed from the platform email tools "Preview HTML Body” and "Notification Preview”, for example these views may have unexpected fonts. The HTML content renders instead normally when an email is viewed from an email client and also in a record's Activity trail. Release or EnvironmentAnyCauseThe ServiceNow platform is sanitizing the HTML when using the "Preview HTML Body” and "Notification Preview” email functions. This will happen if the HTML is invalid, although browsers and email clients may allow the invalid HTML. Full control is allowed 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. ResolutionTo 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 custom 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 to be sure that the HTML is valid and conforming to HTML specifications.Additional InformationHow to strip formatting from text pasted in the Message HTML field of an email notification record Email notification shows HTML tags and markup in sent email