Reputation: 3976
What is the best way to send mass emails using ASP.Net?
For example a site administrator needs to send email (e.g. a newsletter) to all of his site’s users.
What is the best way to do this with ASP.Net 3.5 and C#?
Upvotes: 5
Views: 3790
Reputation: 35107
Edit per Troy's comment.
You should use an external process to send the emails. If your email list grows to a few mere hundred you'll run into timeouts in no time. Once you get into the lists that are a thousand or a million records long you can forget about any workable solution using ASP.Net alone.
I've actually developed a windows service that handles sending out mass emails. Basically in ASP.Net I create a campaign and a batch job in various db records and then insert a list of recipients as well. Once the job has been fully written to the db it's status is changed so that the Windows Service knows it can come along and start processing the job. Then the ASP.Net site can look at the records at any time to determine how far along the service has gotten.
Upvotes: 9
Reputation: 4503
Check out this link >>>> Sending Mass Email using ASP.Net The source is in VB.Net but since the MFCL is the same you can easily change the code in CSharp. However the aspx part remains the same.
Upvotes: 1
Reputation: 73554
If I were writing this on my own, I would simply get the email addresses from the database and loop through using the System.Net.Mail.SmtpClient class.
Please, however, ensure that you are aware of the CAN-SPAM act and that you follow the guidelines.
Upvotes: 2