Value of type 'System.Net.Mail.MailMessage' cannot be converted to 'System.Net.Mail.AlternateView'


Trying to create an alternateview to send a txt email with the html formatted email.  I've used string builder to create the whole email, but I get this error.  Any ideas why?  i've bolded the line that throws the error...
Dim EmailBodyTxt As New StringBuilder
EmailBodyTxt.Append("<html><style type='text/css'>.table{border:solid; border-color:#006666; width:600;} ")
EmailBodyTxt.Append("<body><table class='table'><tr><td colspan='2'><h1>Test
RESPONSE SYSTEM</h1></td></tr> ")
EmailBodyTxt.Append("<tr><td>&nbsp;</td></tr> ")
EmailBodyTxt.Append("</table></body></html>")|
EmailBodyTxt.Append("")
TestEmail.Body = EmailBodyTxt.ToString

AuditEmail.AlternateViews.Add(TestEmail)

Never make important decisions on a Monday!
0
funluckykitty
12/29/2008 9:14:53 PM
📁 asp.net.getting-started
📃 91979 articles.
⭐ 4 followers.

💬 1 Replies
👁️‍🗨️ 2451 Views



It looks like you can't add a MailMessage, you have to pass something that has the type AlternateView. So create an AlternateView instead of a MailMessage.

Jef Claes
~~~~~~~~~~

Visit my blog
0
Nemesis116
12/29/2008 9:33:08 PM
Reply: