Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending out 20,000+ emails with asp.net

I am writing an application that will need to send a massive amount of emails to our students who will be selected from our database (each email will be personalized to the extent that will include their name, course of study etc...so needs to be sent one at a time).

I could do this looping over an SmtpClient, but I'm afraid that with the numbers I'm trying to send, I'll ultimately run into timeout issues or my thread being killed because of lack of machine resources.

At this point I'm just looking for suggestions of a better way to handle this, or if looping over SmtpClient is an ok solution, how I should go about handling it to prevent what I posted above.

Would a web service be a better alternative?

Please advise, TIA

like image 554
Kyle Avatar asked Apr 12 '10 17:04

Kyle


People also ask

Can you send out mass emails?

Mail merge is a way to send personalized mass emails by combining personal data taken from a subscriber list such as an email, first name and business address. You'll need to install a Google Workspace extension to add mail merge features to Gmail to send bulk emails.


1 Answers

My suggestion would be to batch this out. Do not try to run ASP.NET code to create 20K emails and send them out as you are bound to runinto timeout and performance issues. Instead populate a table with recipient, subject, body and begin a batch process from a windows service. This way your code is executed in a way where lag can be managed, instead of having a web page wait for the request to return.

like image 148
John Hartsock Avatar answered Oct 20 '22 16:10

John Hartsock