Replies: 2 comments 3 replies
-
I would need a test case to investigate this. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Try this test, without the fix, it will throw an error: [Fact]
public void When_HtmlBody_Contains_InvalidTags()
{
var visitor = new HtmlPreviewVisitor();
var message = new MimeMessage();
var body = new TextPart(TextFormat.Html) { Text = "<html><body>Hello, World!<mailto:[email protected].< p=\"\"></p> </body></html>" };
message.Body = body;
message.Accept(visitor);
Assert.Contains("Hello, World!", visitor.HtmlBody);
} |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi @jstedfast,
I encountered an issue recently with one of my clients regarding email parsing. Upon reviewing the email body, I discovered it contained invalid HTML tags, such as:
This invalid tag caused the HtmlPreviewVisitor to throw an error during the parsing of the HTML body:
To address this, I implemented a fix by adding a try...catch block at the end of the HtmlTagCallback method to ignore invalid tags:
Could you please share your thoughts on this fix? I appreciate your feedback.
Best regards,
Mahmood
Beta Was this translation helpful? Give feedback.
All reactions