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 4.5 Relay access denied #114

Closed ghost closed 8 years ago

ghost commented 10 years ago

Hi i use MvcMailer 4.5 on the newly released .NET MVC 5.0.

In 80% of the cases my mails get sent() from the application but in 20% i get this error:

System.Net.Mail.SmtpException: Transaction failed. The server response was: Relay access denied. at System.Net.Mail.RecipientCommand.CheckResponse(SmtpStatusCode statusCode, String response) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, Boolean allowUnicode, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at Mvc.Mailer.SmtpClientWrapper.Send(MailMessage mailMessage) at Mvc.Mailer.MvcMailMessage.Send(ISmtpClient smtpClient)

It feels like MvcMailer loses the email settings that are specified in the web.config in some of the cases.

How can i prevent this from happening?