ASP.NET(vb.net) & Send Email HTML Format - In this article you will learn how to send email using ASP.NET and send with HTML Format.
ShotDev Focus:
- ASP.NET(vb.net) & Send Email HTML Format
Example
AspNetSendMailHTML.aspx
<%@ Import Namespace="System.Web.Mail"%> <%@ Page Language="VB" %> <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) Dim myMail As New MailMessage() Dim strMsg As String myMail.To = "member@shotdev.com" myMail.From = "webmaster@shotdev.com" myMail.Subject = "My Subject" '*** HTML Tag ***' strMsg = "" strMsg = strMsg &"<h1>My Message</h1><br>" strMsg = strMsg &"<table width='285' border='1'>" strMsg = strMsg &" <tr>" strMsg = strMsg &" <td><div align='center'><strong>My Message </strong></div></td>" strMsg = strMsg &" <td><div align='center'><font color='red'>My Message</font></div></td>" strMsg = strMsg &" <td><div align='center'><font size='2'>My Message</font></div></td>" strMsg = strMsg &" </tr>" strMsg = strMsg &" <tr>" strMsg = strMsg &" <td><div align='center'>My Message</div></td>" strMsg = strMsg &" <td><div align='center'>My Message</div></td>" strMsg = strMsg &" <td><div align='center'>My Message</div></td>" strMsg = strMsg &" </tr>" strMsg = strMsg &" <tr>" strMsg = strMsg &" <td><div align='center'>"& Date.Now() &"</div></td>" strMsg = strMsg &" <td><div align='center'>"& Date.Now() &"</div></td>" strMsg = strMsg &" <td><div align='center'>"& Date.Now() &"</div></td>" strMsg = strMsg &" </tr>" strMsg = strMsg &"</table>" myMail.BodyFormat = MailFormat.HTML myMail.Body = strMsg SmtpMail.Send(myMail) myMail = Nothing Me.lblText.Text = "Mail Sending." End Sub </script> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form id="form1" runat="server"> <asp:Label id="lblText" runat="server"></asp:Label> </form> </body> </html>
Screenshot