code_junkie

asp.net mvc framework, automatically send e-mail

Nov 13th, 2011
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. internal static void SendEmail(MailAddress fromAddress, MailAddress toAddress, string subject, string body)
  2. {
  3. var message = new MailMessage(fromAddress, toAddress)
  4. {
  5. Subject = subject,
  6. Body = body
  7. };
  8.  
  9. var client = new SmtpClient("smtpServerName");
  10. client.Send(message);
  11. }
  12.  
  13. public class BaseController : Controller
  14. {
  15. protected override void OnActionExecuted(ActionExecutedContext filterContext)
  16. {
  17. // Send mail here
  18. base.OnActionExecuted(filterContext);
  19. }
  20. }
Add Comment
Please, Sign In to add comment