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
Post a Comment