Advertisement
Guest User

Untitled

a guest
Jul 8th, 2016
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. var errorMessage = "";
  2. try
  3. {
  4. WebMail.SmtpServer = "smtp.mail.ru";
  5. WebMail.SmtpPort = 465;
  6. WebMail.EnableSsl = true;
  7. WebMail.UserName = "vika97";
  8. WebMail.Password = "mypassword";
  9. WebMail.From = "vika97@mail.ru";
  10. WebMail.Send("taker@bk.ru", "RSVP Notification",
  11. Model.Name + " is " + ((Model.WillAttend ?? false) ? "" : "not")
  12. + "attending");
  13. }
  14. catch (Exception ex)
  15. {
  16. @:<b>Sorry - we couldn't send the email to confirm your RSVP.</b>
  17. errorMessage = ex.Message;
  18. }
  19. }
  20. <div>
  21. @if (errorMessage == "")
  22. {
  23. <p> An email message has been sent to our customer service department.</p>
  24. }
  25. else
  26. {
  27. <p><b>The email was <em>not</em> sent.</b></p>
  28. <p>The following error was reported:</p>
  29. <p><em>@errorMessage</em></p>
  30. }
  31. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement