Send mail using SMTP Server in C#

Karthikanbarasan
Posted by Karthikanbarasan under C# category on | Points: 40 | Views : 4592
using System.Web.Mail;

public void SendMailusingCsharp()
{
MailMessage mail = new MailMessage();
mail.From = "from Email ID";
mail.To = "To Email ID";
mail.Subject = "MAIL Subject";
mail.BodyFormat = Mailformat.html;
mail.Body = "Mail body format"; --we can put a html format as well
SmtpMail.SmtpServer = "SMTP Server Name";
SmtpMail.Send(mail);
}

Comments or Responses

Login to post response