Advertisement
Guest User

Untitled

a guest
Jun 30th, 2017
1,567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. MailMessage mail = new MailMessage();
  2. mail.To.Add("hira.aftab87@gmail.com");
  3. // mail.To.Add("amit_jain_online@yahoo.com");
  4. mail.From = new MailAddress("jagdeepmatharu@gmail.com");
  5. mail.Subject = "Email using Gmail";
  6.  
  7. string Body = "Hi, this mail is to test sending mail" +
  8. "using Gmail in ASP.NET";
  9. mail.Body = Body;
  10.  
  11. mail.IsBodyHtml = true;
  12. SmtpClient smtp = new SmtpClient();
  13. smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
  14. smtp.Port = 587;
  15.  
  16. smtp.Credentials = new System.Net.NetworkCredential
  17. ("jagdeepmatharu@gmail.com", "root.8787");
  18. //Or your Smtp Email ID and Password
  19. smtp.EnableSsl = true;
  20. smtp.Send(mail);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement