Guest User

Untitled

a guest
Mar 6th, 2018
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. static void Send(string login, string password , string mailSend, string subject , string body , string proxyHost, int proxyPort)
  2. {
  3.  
  4. SmtpClient smtp = new SmtpClient("smtp.mail.ru", 587);
  5. smtp.Credentials = new System.Net.NetworkCredential(login, password);
  6.  
  7. MailMessage mail = new MailMessage();
  8.  
  9. mail.From = new MailAddress(login);
  10. mail.To.Add(new MailAddress(mailSend));
  11. mail.Subject = subject;
  12. mail.Body = body;
  13. smtp.EnableSsl = true;
  14.  
  15. smtp.Send(mail);
  16. }
  17.  
  18. var smtp = new SmtpConnection();
  19. smtp.Proxy = new HttpProxy("ip-адрес", 8080);
  20. smtp.Connect("smtp.mail.ru", 587);
  21.  
  22. smtp.ExtendedHello("mail.ru");
  23. smtp.StartTls("mail.ru");
  24.  
  25. smtp.ExtendedHello("mail.ru");
  26. smtp.AuthPlain("mail_acc", "password");
  27.  
  28. smtp.Mail("mail_acc@mail.ru");
  29. smtp.Recipient("recipient@gmail.com");
  30. smtp.Data(EmailFormatter.GetText("Bill Gates <mail_acc@mail.ru>", "Subject", "Steve Jobs <recipient@gmail.com>", "Hello"));
  31. //smtp.Data(EmailFormatter.GetHtml("Bill Gates <mail_acc@mail.ru>", "Subject", "Steve Jobs <recipient@gmail.com>", "<h1>Hello!</h1><a href='stackoverflow.com'>click!</a>"));
  32.  
  33. smtp.Quit();
Add Comment
Please, Sign In to add comment