We confirmed with the Microsoft product group that the email validation error is a known bug, and a fix is already being rolled out. They’ve applied a patch across the Government Cloud. While I’m still seeing the error message, the good news is that we’re now receiving email notifications.
All APIM email notifications failing — “Provided template body is not a well-formed HTML document
Hello Microsoft Support,
We are experiencing an issue where none of the email notifications in Azure API Management (APIM) are being sent — this includes all default notification types (sign-up confirmations, subscription requests, etc.).
When reviewing the notification templates in the Azure Portal under Notifications > Templates, we consistently receive the following error in all of our templates:
"Provided template body is not a well-formed HTML document"
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<p style="font-size:12pt;font-family:'Segoe UI'">Dear $DevFirstName $DevLastName,</p>
<p style="font-size:12pt;font-family:'Segoe UI'">
Thank you for your interest in our <strong>$ProdName</strong> API product!
</p>
<p style="font-size:12pt;font-family:'Segoe UI'">
We were delighted to receive your subscription request. We will promptly review it and get back to you at <strong>$DevEmail</strong>.
</p>
<p style="font-size:12pt;font-family:'Segoe UI'">Thank you,</p>
<p style="font-size:12pt;font-family:'Segoe UI'">The $OrganizationName API Team</p>
<p><a style="font-size:12pt;font-family:'Segoe UI'" href="http://$DevPortalUrl">$DevPortalUrl</a></p>
</body>
</html>
However, we’ve validated the HTML for multiple templates using W3C and other HTML validators and confirmed that:
The templates contain complete, well-structured HTML documents (<!DOCTYPE html>
, <html>
, <head>
, <body>
)
No syntax issues, broken tags, or empty elements are present
What we’ve done so far:
- Verified SMTP settings are correctly configured under Notifications > Email
- Enabled diagnostic logs, but
AzureDiagnostics
shows no log entries for email or notification-related activity
Our Questions:
- What conditions might cause the “not a well-formed HTML document” error even when the HTML is valid?
- Is there any internal validation mechanism in APIM that might be rejecting standard HTML5 syntax (e.g.,
<meta charset="UTF-8">
,<head></head>
)? - Could there be a regression or platform-side validation issue affecting all templates?
- Is there a way to obtain deeper diagnostic logs or traces showing template rendering or notification delivery attempts?
Any guidance or escalation would be greatly appreciated, as this issue is blocking all APIM-generated communication.
Thank you