Reputation: 57833
I'm writing a user registration process in ASP.NET MVC 3 RC, and I'd like to send a confirmation email to the user during that process. I know I can do this using the classes in the System.Net.Mail
namespace, but I have a few questions on the best way to implement this.
Before I go down the path of writing my own code to send email, are there any existing solutions like ActionMailer for ASP.NET MVC?
If I do roll my own, should I do this on the web server during the request and would using Send bog down the web server, tying up threads as they wait on the SMTP server to respond? If so, would SendAsync be preferable?
Would it be better pull this out of ASP.NET MVC entirely, maybe by writing a record to a database table and having a windows service periodically sweep the table and send out the messages?
At the moment, I am leaning towards #3, since that would give me the flexibility of doing this work on another server entirely, but was wondering what others are doing. Are there options and/or issues I haven't considered?
Upvotes: 0
Views: 1523
Reputation: 3805
MvcMailer is like an ActionMailer for .Net. See the NuGet package here and the project documentation
Hope it helps!
Upvotes: 3
Reputation: 219087
Personally I would agree that #3 is your best option. It's the most complex of the three, but none of them are terribly complex. What it does do, however, is:
As for an existing library for making the creation/sending of the MailMessage
objects easier, I've never seen a need. If you're just sending the messages to an SMTP server, the built-in objects are more than adequate and easy to use.
Upvotes: 4