Best practise to send mass email within application (ASP.NET MVC 2, C#)?
- by gurdan
Whats the best way to implement mass email sending feature within web app? Two major cases:
Email messages for separate registered users depending on their activities (just sending short reminders to user for ex about new posts in his created topic)
"Send email for all registered users" functionality, it will be nice to have feature for system administrator to send some messages for all registered users. Of course adding all emails to recipient isn't the way we can go, because email addresses for each user are anonimous.
As i understand for case nr1 there is no problem just create some email message via System.Net.Mail by creating new mail message and sending it... but what about case nr 2???
i guess smth like this:
foreach(var emailAddress in emailAddresses) {
MailMessage mail = new MailMessage();
mail.From = new MailAddress("[email protected]");
mail.To.Add(emailAddress);
mail.Subject = "test";
mail.Body = "test";
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
smtp.Send(mail);
}
isn't the good way :) so the question is what is the best way to achieve this ?
btw we have no possiblity to deploy some serive for email sending, this should be integrated into web application.