U ) Send Email

                                                          *  Email  *

    Tranfer email msg to anyone 

Rules :- 1 ) Gmail 2 step verification is compulsary to generate 16 digit appcode password

             2 ) Using email password to activate 16 digit password 

Step :- Gmail -- Security -- two step verification on -- app password -- Enter your gmail password -- Activate -- copy 16 digit password 

 

 Library :-    using System.Net.Mail; // library1

                   using System.Net;           // library2

 Code :-

          MailMessage mail = new MailMessage();

        mail.To.Add(txtmail.Text.ToString().Trim());

        mail.From = new MailAddress("sourabhthakre7721815360@gmail.com");

        mail.Subject = "hello test email";

        mail.Body = "<p>Hi i send mail for testing</p>";

        mail.IsBodyHtml = true;


        SmtpClient smtp = new SmtpClient();

        smtp.Port = 587;

        smtp.EnableSsl = true;

        smtp.UseDefaultCredentials = false;

        smtp.Host = "smtp.gmail.com";

        smtp.Credentials = new System.Net.NetworkCredential("sourabhthakre7721815360@gmail.com", "jshopitrecghterq");

        smtp.Send(mail);


                              



Comments

Popular posts from this blog

DATA CONTROL ( Gridview , Repeater , Formview , DataList , Detailsview , Listview )

Z 5 ) MVC (Model view Controller)

Z 8 ) MVC HTMLHELPER METHOD AND ACTIONLINK (how to use css ,atrributes,style in css)