Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send Newsletter in asp.net to around 10000 emails

i have to write application for sending newsletter. what is the best way to send newsletter thoundands of users? My requirement is

  1. Each mail is seprately as To :
  2. Every mail has unique Unsubscribe link

Is is good to use SMTP mail class of .net? I look aound may questions in so but can't decide which approcah i should go? There are many suggestions

  1. Multi threaded Windows service
  2. Use Mail Server
  3. Add thread.sleep(2000) between each send.

can anyone suggest good way to imepement this?

like image 830
Pragnesh Patel Avatar asked Jun 28 '10 15:06

Pragnesh Patel


2 Answers

I would not recommend asp.net webpage to send, even if you do start it in a separate background thread. I would think you run the risk of the server recycling your process in the middle of the send, which would mess it up. You really need to write some kind of separate service or application to send your emails.

The simplest option would be to just create a quick and dirty console or windows form application.

Also logging is critical just like the other poster said. If it fails you want to know exactly what got sent out and where it stopped so that when you restart it you don't mail all the people who it did work for again. You want to be able to input the starting point for the send, so if you need to restart at number email #5000 you can.

The classes in System.Net.Mail namespace will work just fine for sending your mail.

One of the biggest problems will be finding a email host that will let you send so many emails. Most email hosts have throttling and sometime it changes depending upon server conditions so if the server is being heavily used then the email limits will be more restrictive, and you may only get to set 500 emails per hour.

We have a newsletter that goes out to around 20000 people as separate emails and we had to play around with the delay between emails until we found one that would work for our email host. We ended up with 1.2 sec between emails, so that might be a good starting point.

I think there are email hosts specialize in bulk mailings though so if you get one of those it might not be a problem.

Also if you host your own email this may not be a problem. And if you do host your own mail you will have the option of dropping the mail in the pickup directory and you could just dump it all in there as fast as you want, and let the email service pick it up at it's own pace.

EDIT: Here is the settings to add to the config file for setting the pickup directory

<system.net>
    <mailSettings>
        <smtp from="[email protected]" deliveryMethod="SpecifiedPickupDirectory" >
            <specifiedPickupDirectory pickupDirectoryLocation="Z:\Path\To\Pickup"/>
        </smtp>
    </mailSettings>
</system.net>
like image 189
Chris Mullins Avatar answered Sep 30 '22 13:09

Chris Mullins


Definitely do not do this in ASP.NET. This is one of the biggest mistakes that new web developers make.

This needs to be a windows app or service that can handle this much volume.

like image 34
Ed B Avatar answered Sep 30 '22 12:09

Ed B