c# - Is there an equivalence to CDOSYS AutoGenerateTextBody in .NET -


I am porting some VBScript code which generates email using standard CDOSYS message objects. The message oject has an asset AutoGenerateTextBody , when you specify the HTML for the HTMLBody property, then the value is automatically written to the TextBody property Will create the value. Therefore, the message creates typical text / plain and text / HTML options in the body.

However, this function appears to be a .NET. The object has the ability to create alternative ideas in the Mailmage object, but HTML content does not easily show how to create text body content.

I'm not necessarily searching for an auto magic option but I need a solution to take an HTML string and convert it to a fair plain text presentation. Except not just all HTML markup, it is not cut.

Is any existing device buried somewhere in the existing NAT framework that can do this?

I do not know anything in the .NET framework, but you do not know anything about the CD Can use Of course this sounds a bit of a dirty hack, but it works!

Add a reference to "Microsoft CDO for Windows 2000 Library" (in the Comm tab of the "Add Reference" dialog) and you go away:

  Public String GetTextBody (String HTML Body) {CDO.Message msg = New CDO.Message (); Msg.AutoGenerateTextBody = True; Msg.HTMLBody = html body; Return msg.TextBody; }  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -