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
<head><meta charset=\"utf-8\" content=\"text/html\" http-equiv=\"Content-Type\"/><meta content=\"noindex,
nofollow, noarchive\" name=\"robots\"/><meta content=\"noindex, nofollow, noarchive\" name=\"googlebot\"/></head>
- 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:
<p style=\"text-align:center;\"><a href=\"https://moe_nlbl.em-staging.moestaging.com/
v1/emailview?q=Mi6d.xBht5tyEj_INcLCXHXCfdjsi4QiAB_v9uDLewPUx.zAQxMn8bsBVaBuGQAMKnWX-
Uls1vA2j_VWB3TF08b96XTmXPHkzeKjJjEgvUPXzpj2KP0CVfWrkGXdI9udDE2M9JyIyacapt5wnhwK2HJ626fQWjhYquY59_
LAqcE0dy8c1XaHwW1aEnIXS9uzmqMprgAW5y3.b9zoqHQ4-fx9y8VvO0l7VVrdCBge.TqlUwDYjtB8z0f4ZBQ21hL2_
U5pMrfI3sEVNAW5xc7rcj8ej06K2xw&event_date=2025-07-11&event_time=1752206312\"
id=\"moe_internal_email_vib\">View in browser</a></p> -
Open tracking pixel: An open tracking pixel is inserted into the HTML, along with necessary styling as below:
<img src=\"https://moe_nlbl.em-staging.moestaging.com/v1/emailopen?q=j1vTe6H7
y09dUFUqGje78kyXWHatIRHnWOAe9ucVceX0wJPLnHLjDhYLCMcVAOGoSbbd-M4qee2b.VrSS8f8Y9dK.
ubhElcv6QztFhjr8F2xwk9VJBN1AGczayfUxAtOcOFR8SOEIg28JIHWLN2y6iRxB18jeLGuMxpb_mcxyblAU.
fPh0kZbt26XSV_INzcCU.H5EfMePgrEPOEBbF4-slGc1jyHVUX7JF2nv3dDjYrkLJpsCfcij8ehbjgEr1ocZt
APBR4cwGcFQIWzPVsZWxdM2eVavw-cBlXQLUsIhZRFvLotuGTxbrjDTfqPi.tRLk4wigGo.UlCAS1_NyfEq7M
kDUg4Wty5WD_c3kJq4Rp\" alt=\"\" style=\"display:none;width:1px;height:1px;\" height=\"1\
" width=\"1\"> -
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):
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<strong>test 123
<p>My first paragraphThe HTML code edited by MoEngage is:
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<strong>test 123 </strong>
<p>My first paragraph</p>
</body>
</html> - 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.