mganss / HtmlSanitizer

Cleans HTML to avoid XSS attacks
MIT License
1.51k stars 198 forks source link

Allow outlook conditional comments #537

Closed atamir93 closed 3 months ago

atamir93 commented 3 months ago

Hi, I'm using HtmlSanitizer to sanitize mail tamplates. But currently have problem with allowing conditional comments? Here is there any way to allow also <![if mso | IE]> and <![endif]> part?

<![if mso | IE]><table align=""center"" border=""0"" cellpadding=""0"" cellspacing=""0"" class="""" role=""presentation"" style=""width:650px;"" width=""650"" bgcolor=""#000028"" ><tr><td style=""line-height:0px;font-size:0px;mso-line-height-rule:exactly;""><![endif]>

Thanks.

mganss commented 3 months ago

You have subscribe to the RemovingComment event and set the Cancel property to true for those comments you want to keep. See also #525.