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 *

8 + 8 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">