Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var errorMessage = "";
- try
- {
- WebMail.SmtpServer = "smtp.mail.ru";
- WebMail.SmtpPort = 465;
- WebMail.EnableSsl = true;
- WebMail.UserName = "vika97";
- WebMail.Password = "mypassword";
- WebMail.From = "vika97@mail.ru";
- WebMail.Send("taker@bk.ru", "RSVP Notification",
- Model.Name + " is " + ((Model.WillAttend ?? false) ? "" : "not")
- + "attending");
- }
- catch (Exception ex)
- {
- @:<b>Sorry - we couldn't send the email to confirm your RSVP.</b>
- errorMessage = ex.Message;
- }
- }
- <div>
- @if (errorMessage == "")
- {
- <p> An email message has been sent to our customer service department.</p>
- }
- else
- {
- <p><b>The email was <em>not</em> sent.</b></p>
- <p>The following error was reported:</p>
- <p><em>@errorMessage</em></p>
- }
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement