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();
}
}

Tagged: , , , ,

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 )

Connecting to %s

%d bloggers like this: