Send E-mail using ASP.Net

Send e-mail using c# in ASP.Net.

first Import the below namespace in your web application.

  • using System.Net.Mail; 

Code for Send email using ASP.Net

  • MailMessage message = new MailMessage();
    MailAddress fromAddress = new MailAddress(“”, YourName);
    message.From = fromAddress;

    message.To.Add(“”);  message.Subject = “Meera Academy – Information”;
    message.IsBodyHtml = false;
    message.Body = “Your Message”;

    SmtpClient sc = new SmtpClient();

    sc.Host = “”;                           
    sc.Port = 587;
    sc.Credentials = new System.Net.NetworkCredential(“”, “gmailpassword”);

             sc.EnableSsl = true;

    sc.DeliveryMethod = SmtpDeliveryMethod.Network;

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha *