Advertisement
Guest User

Untitled

a guest
Jun 18th, 2015
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. string fromemailid;
  2. string from_email_pwd;
  3. fromemailid = "myemail@gmail.com";
  4. from_email_pwd = "*******xyz";
  5. MailAddress fromaddress = new MailAddress(fromemailid);
  6. MailAddress toaddress = new MailAddress("example@gmail.com");
  7. MailMessage msg = new MailMessage(fromaddress, toaddress);
  8. msg.Subject = ("newdemo");
  9. msg.Body = ("ok ");
  10. msg.Priority = MailPriority.High;
  11. System.Net.Mail.SmtpClient mailsender = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);
  12. System.Net.NetworkCredential mailauthantication = new System.Net.NetworkCredential(fromemailid, from_email_pwd);
  13. mailsender.EnableSsl = true;
  14. mailsender.UseDefaultCredentials = false;
  15. mailsender.Credentials = mailauthantication;
  16. mailsender.Send(msg);
  17. string display = "Done Check your Mail !";
  18. ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "sweetAlert('" + display + "','','success')", true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement