+1 vote
by (130 points)

Is there something hidden in the MailMessage class that helps me getting a Html Body (only Html in the mail no Plaintext) as PlainText?

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (134k points)

Unfortunately, MailMessage does not include any a HTML-to-PlainText converter. You might consider using a third-party library for this task, such as HTML Agility Pack.

by (130 points)
thanks Lukas,

i actually have code that uses the HtmlAgilityPack just need to bring it into the .Net Core world. Current nuget package seem to be standard 2.0 so might be easy.

Was hoping for something even easier. Just need to parse those dammed Journal Reports from Exchange. The structure is as plain as it can be but still they made html out of it :(
by (134k points)
Yes, we actually did consider adding a HTML-to-plain converter some time ago, but converting HTML to plain text is a surprisingly complicated task that might lead to all kinds of strange results in rare cases, so we abandoned the idea. We might reconsider it in future based on demand in this. It would be useful.
...