Home > ASP.NET > Send mail using local SMPT server

Send mail using local SMPT server

 public void sentMail(string from,string to,string subject,string body)
{
MailMessage mailObj = new MailMessage(from,to,subject, body);
SmtpClient SMTPServer = new SmtpClient(“localhost”);
try
{
SMTPServer.Send(mailObj);
Label1.Text = “Mail Sent”;
}
catch (Exception ex)
{
Label1.Text = ex.ToString();
}
}

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s

%d bloggers like this: