Guest User

Untitled

a guest
Jul 19th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. using (SynchronizationContextSwitcher _ctxSwitcher = new SynchronizationContextSwitcher())
  2. {
  3.  
  4. SmtpClient smtp1 = new SmtpClient() { Host = "" };
  5.  
  6. using (MailMessage msg = new MailMessage() {
  7. From = new MailAddress(""),
  8. Subject = "",
  9. IsBodyHtml = true})
  10. {
  11. smtp.SendCompleted += (s, e) =>
  12. {
  13. if (!e.Error.Equals(null))
  14. {
  15. //...
  16. }
  17.  
  18. };
  19.  
  20. smtp.SendAsync(msg, "");
  21. }
  22. }
Add Comment
Please, Sign In to add comment