Send HTML Messages using .NET
Create and Send HTML mails using VB.NET
Use the IsBodyHtml property to specify whether the body of the e-mail message contains plain text or HTML markup
Imports System.Net.Mail
Sub Create_HTML_Mail()
Dim oMailMsg As MailMessage
Dim oSMtPClient As SmtpClient
oMailMsg = New MailMessage
oMailMsg.From = New MailAddress("sample@dotnetdud.com", "Dot Net Dud Sample")
' If you do not use the constructor and add address using To.Add you can add more addresses
oMailMsg.To.Add(New MailAddress("subscriber@dotnetdud.com", "Feed Subscribers"))
oMailMsg.To.Add(New MailAddress("techwriters@dotnetdud.com", "Tech Writers"))
oMailMsg.Subject = "Welcome to Mailing List"
oMailMsg.Body = <HTML><body><H1>Welcome to DotNetDud Mailing List</H1><p>You will get mails on .... </P></body></HTML>
' IsBodyHtml differentiates from Text message and HTML Message
oMailMsg.IsBodyHtml = True
oSMtPClient = New SmtpClient("smtp.dotnetdud.com")
oSMtPClient.Send(oMailMsg)
End Sub
No comments:
Post a Comment