Hi
I'm working on a system that creates emails using the System.Net.Mail MailMessage class and want to know if there's a way to have it automatically create the Plain Text version of an email from the HTML version.
I've previously used CDO's Message class which would do this for you like so (example taken from MSDN):
Dim iMsg As New CDO.Message
Dim strHTML As String
strHTML = "<HTML><h1>Hello There</h1></HTML>"
Set iMsg = New CDO.Message
With iMsg
.To = "Somebody@example.com"
.From = "another@example.com"
.Subject = "Sample multipart/alternative message"
.HTMLBody = strHTML ' .TextBody gets generated automatically
.Send
End With
This happens when the AutoGenerateTextBody property of a CDO.Message is set to True (the default).
Is there a property of the MailMessage class that does this? Or is there another way .NET can convert HTML code to Plain Text?
Thanks!
Ben