Advertisement
Guest User

Untitled

a guest
Nov 27th, 2015
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1.  
  2. public static bool SendMail(string userMail, string subject, string body, bool isHtml = false)
  3. {
  4. try
  5. {
  6. System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
  7. mail.IsBodyHtml = isHtml;
  8. mail.From = new System.Net.Mail.MailAddress("Geolab@gmail.com");
  9. mail.To.Add(userMail);
  10. mail.Subject = subject;
  11. mail.Body = body;
  12.  
  13. System.Net.Mail.SmtpClient SmtpServer = new System.Net.Mail.SmtpClient("smtp.mandrillapp.com");
  14. SmtpServer.Port = 587;
  15. SmtpServer.Credentials = new System.Net.NetworkCredential("geolab.mvc@gmail.com", "IIJQTqUopIBbu0kCpRZPsA");
  16. SmtpServer.EnableSsl = false;
  17.  
  18. SmtpServer.Send(mail);
  19. return true;
  20. }
  21. catch
  22. {
  23. return false;
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement