How to send a formated mail in ASP.Net

Send HTML Formated e-mail in ASP.Net

Send email with ASP.Net is easy task,
If you want to send email with HTML format, you must write this line in code : message.IsBodyHtml = true;

The code for simple send email is belows :

<%@ Import Namespace=”System.Net.Mail” %>

protected void Page_Load(object sender, EventArgs e)
//create the email message
MailMessage email = new MailMessage();
//set the from addresses
email.From = new MailAddress(“”);

//set the to Address

//set the email subject and body , message
email.IsBodyHtml = true;
email.Subject = “Subject of Email – MeeraAcademyl”;
email.Body = “This is the Body of Email / Message of Email.”;

//send the message using smtpclient
SmtpClient smtp = new SmtpClient(“localhost”);
lblmsg.Text = “Send Mail Successfullyt”;

The code for HTML formated email is belows :

all the things/code are same as above only code has been changed ::

email.IsBodyHtml = true;

email.Body = “<html><table border=’1′ bordercolor=’#003300′ style=’z-index: 100; left: 376px; width: 616px;position: absolute; top: 10px’>
<tr><td bgcolor=’#9b0033′ style=’width: 75px; text-align: center’><strong><span style=’font-size: 35px; color: #ffffff; font-family: Tahoma’></span></strong></td></tr><tr style=’font-size: 12pt’><td rowspan=’2′ style=’width: 75px; height: 312px’ valign=’top’><br />
<span style=’font-size: 11pt; font-family: Tahoma’><strong><span style=’color: #990033′><span style=’font-size: 15px’>
Thanks for registering with</span><br /></span><br /><br /></strong><strong>
<span style=’color: #990033′>Your meeraacademy UserName: Hello</span> <br /><span style=’color: #990033′>your meeraacademy password : Meera
</span><br /><span style=’color: #990033′>If you have any questions or problems, please contact us from
</span><br /><span style=’color: #990033′>Thanks,<br />
<a href=’’></a>

The output is like :


Send formated email with ASP.Net


Here another Example of Formated Email ::

email.IsBodyHtml = true;

email.Body =”<html><table border=’1′ bordercolor=’#003300′>
<tr><td>Hello MeeraAcademy</td></tr><tr><td>Welcome to meeraacademy</td></tr>


Send formated email with ASP.Net

Send formated email with ASP.Net



Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha *