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
582 stars 178 forks source link

MVCMailer sending duplicate emails #113

Open amjadkhan opened 11 years ago

amjadkhan commented 11 years ago

Problem : 2 emails are being sent per MvcMailMessage instead of 1 - essentially a duplicate.

I have configured MVCMailer to use a custom SMTPClient configured from the appSettings of my web.config. In my Mailer method instead of returning the call to Populate, I am using the Populate method from MailerBase and assigning the MVCMailMessage to a variable. I then call GetSmtpClient as SmtpClientWrapper and set the InnerSmptClient to my custom configured SmtpClient. To send the message I am calling the Send method on the MVCMailMessage passing in the SmtpClient Finally, I return the MVCMailMessage from my Mailer method.

Why are 2 messages being sent per message?

Edit: When smtp settings in web.config are set to pickupDirectory, 1 email is sent to the specified pickup directory. When smtp settings are set to network then 2 emails are sent per message. I have commented out the call to GetSmtpClient and am using the settings set in the network node of the web.config and still 2 emails.