smsohan / MvcMailer

A Mailer for ASP.Net MVC that forms the Email Body using MVC Views (Razor etc.) following Ruby on Rails ActionMailer style
MIT License
585 stars 176 forks source link

MvcMailer Stopped Functioning Altogether. #130

Closed jamsoft closed 9 years ago

jamsoft commented 10 years ago

For some reason MvcMailer has stopped sending emails and all my tests are showing that there really shouldn't be a problem.

I have the following in an action method:

IUserMailer mailer = new UserMailer(); var emailModel = new AccountConfirmEmailModel(); emailModel.ToEmailAddresses.Add(model.Email);

emailModel.Token = userProfile.Membership.ConfirmationToken; emailModel.AccountCreationDateTime = userProfile.CreatedUtc; emailModel.DisplayName = userProfile.DisplayName; emailModel.FirstName = userProfile.FirstName; mailer.AccountConfirmation(emailModel).Send();

var client = new SmtpClient(); client.Send("from@email.add", model.Email, "Test!", "This got through!!");

And I have this configured in my web.config:

The email sent using SmtpClient explicitly arrives without any issue but the MvcMailer email vanishes into the ether and never arrives.

I've tried printing the emails to disk to check that MvcMailer could find it's associated views, to do this I used the alternative smtp settings like this:

This all works perfectly, the emails are formatted correctly and have obviously found and used the MvcMailer views.

The smtp settings are obviously correct as the SmtpClient explicitly sent email works. I'm really not sure what else to check for issues.

Has anyone seen this happen before and have a potential solution? Or ideas for forther tests / checks?

flaria commented 9 years ago

I'm having a similar issue. Suddenly no emails are being sent. Did you ever find out what happened or how to solve this?

smsohan commented 9 years ago

Did you check your networking/email quota? If there's an email sending failure, you should first check your log files, then your network/SMTP connectivity, and finally your email server.

flaria commented 9 years ago

Big duh! moment. In my case, I forgot to add the Send() method to the MvcMailMessage for the messages that were not being sent. Thanks for the quick response to my comment. Don't know what could be the problem for @jamsoft. Hopefully is something as simple as this.

smsohan commented 9 years ago

:+1: