Sending mail through Asp.net


Sending mail through Asp.net

Example of Sending mail through Asp.net


Import Namespace using System.Web.Mail;
//Create a object on MailMessage
MailMessage objMailMessage = new MailMessage();
//Mention the TO Address
objMailMessage.To = "mail1@gmail.com";
//Mention the From Address
objMailMessage.From = "mail2@gmail.com";
//Subject of the mail
objMailMessage.Subject = "Hi";
//Body of the mail
objMailMessage.Body = "Hello how are u ,Thank u";
//mail format
objMailMessage.BodyFormat = MailFormat.Html;
//SmtpMail.SmtpServer = "206.190.60.37";
SmtpMail.Send(objMailMessage);


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: