Sending out 20,000+ emails with asp.net Sending out 20,000+ emails with asp.net asp.net asp.net

Sending out 20,000+ emails with asp.net


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.


Ok, first - this is hardly massive, I have been handling 50.000 emails+

Let the emails be written to a FOLDER - directory. Then use the local SMTP service you can install, pointing it at the folder as pickup directory. This will at least make sure you have a decent buffer in between (i.e. you can finish the asp.net side, while the emails are not sent at that point).


What about using Database Mail tool provided by SQL Server itself. You can still use asp.net but Email will be sent by SQL Server and all you have to do call the stored procedure and leave things to SQL Server.

I wouldn't recommend batch option since there won't be any optimization or queue thing unless you have to put a lot of effort to do so.

Database Mail tool provides queue and priority options as well. If a problem occurs, the e-mail will be queued again and sent later but the other ones will be still being sent.

It is called Database Mail in SQL Server 2008 and SQL Mail in previous versions.

For more information, please check the links below :