Is there an equivalence to CDOSYS AutoGenerateTextBody in .NET

Posted by AnthonyWJones on Stack Overflow See other posts from Stack Overflow or by AnthonyWJones
Published on 2009-10-19T09:46:35Z Indexed on 2010/03/24 6:03 UTC
Read the original article Hit count: 341

Filed under:
|
|
|

I'm porting some VBScript code which generates emails using the standard CDOSYS Message object. The Message oject has a property AutoGenerateTextBody which when true will cause it to automatically create the TextBody property value when you assign HTML to the HTMLBody property. Hence creating the typical text/plain and text/html alternatives in the message body.

However .NET appears to be missing this function. The MailMessage object does have the ability to create alternative views but there doesn't appear to be a way to easily create the text body content from the HTML content.

I'm not necessarily looking for an auto-magic option but I do need a solution to taking what is an HTML string and converting it to a reasonable plain text representation. Just dropping all the HTML markup doesn't cut it.

Is there a tool buried somewhere in the existing .NET framework that can do this?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about email