Archive

Posts Tagged ‘SMTP’

Send mail using local SMPT server

December 28, 2012 Leave a comment

 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
%d bloggers like this: