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(“meera@academy.com”, YourName);

    message.From = fromAddress;

    message.To.Add(“info@academy.com”);  

    message.Subject = “Meera Academy – Information”;

    message.IsBodyHtml = false;

    message.Body = “Your Message”;

    SmtpClient sc = new SmtpClient(); 

                                 

    sc.Host = “smtp.gmail.com”; 

                               
    sc.Port = 587;
    sc.Credentials = new System.Net.NetworkCredential(“demo@gmail.com”, “gmailpassword”);

             sc.EnableSsl = true;

    sc.DeliveryMethod = SmtpDeliveryMethod.Network;
    sc.Send(message);

Leave a Reply

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

5 + 4 =


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="">