Auto-Formats Independent of the Auto-format HTML Code Toggle
MoEngage automatically applies the following edits to your HTML code in the custom HTML editor, regardless of the Auto-format on HTML code toggle in the General Settings of Email.-
Head and Meta tag management
- If a
<head>tag is already present in your HTML code, MoEngage adds meta tags within it. - If no
<head>tag is found, MoEngage adds one and inserts the following meta tags inside
- If a
-
View In Browser (VIB) link insertion: The View in browser (VIB) link, based on sentry configuration and is added along with necessary styling as below:
-
Open tracking pixel: An open tracking pixel is inserted into the HTML, along with necessary styling as below:
-
HTML tag correction: MoEngage utilizes a backend library (BeautifulSoup) to correct incomplete or malformed HTML tags.
If your HTML has opening tags without corresponding closing tags, BeautifulSoup adds them. For example, if below is your HTML code (without closing and opening tags):
The HTML code edited by MoEngage is:
-
An empty
<b />tag, which is not valid HTML, will be transformed into a proper<b></b>tag pair. For example, if your HTML code is:<a><b /></a>, The HTML code edited by MoEngage is:<a><b></b></a> -
If there is only a closing tag without a corresponding opening tag, that tag will be ignored entirely, or corrected if possible.
For example, if your HTML code is:
<a></p>, The HTML code edited by MoEngage is:<a></a>
Auto-Formats Dependent on the Auto-format HTML Code Toggle
MoEngage performs the following edits only if you enable the Auto-format HTML code toggle in the General Settings of Email. For more information, refer to Configure Email Channel.- Removing empty tags (unless listed in htmlAllowedEmptyTags).
- Normalizing whitespace and removing unnecessary or trailing spaces.
- Inserting
<br>where structurally required for visual breaks. - Sanitizing lists and tables, including auto-inserting
<tbody>inside<table>, etc. - Cleaning up redundant
<br>or<div>tags. - Converting deprecated/invalid tags and attributes to HTML5 standards.
- Removing invalid or unknown attributes based on the editor configuration.
- Fixing nested structures that are non-compliant with HTML rules.