Sending Mails using .NET


In this post i am going to explain sending an email using .NET and get the confirmation from the user — by clicking the Link, which is send along with the email. To send emails you have to import the namespace ‘System.Web.Mail’. Following code snippet will show how..

Imports System.Web.Mail
.
.
.
private void sendMail()
{
string sBody;
MailMessage mailMsg = new MailMessage();
mailMsg.BodyFormat = MailFormat.Html;
SmtpMail.SmtpServer = “your Server name”;
mailMsg.From = "your email address";
mailMsg.To = “to email address”;
mailMsg.Subject = “subject line of the mesg”;
mailMsg.Body = sBody;
SmtpMail.Send(mailMsg);
}


In the above code most of the things are self explanatory.
To be contd… — How to get confirmation from the user?

One response to “Sending Mails using .NET

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s