views:

353

answers:

7

Hi,

We have made a .NET service application to send emails to all the registered users of our website.

We have 2,634,789 users and the mail has to go to all of them. In the program I am fetching the information related to 100 users at a time (to avoid database calls) and storing that in the program (in a DataTable) and then sending the mail asynchronously. Likewise I am doing it for the remaining users.

Now my doubt is that is it the best way or are there any other best ways to achieve this? Please provide the reference link (if needed).

Many Thanks, Regards. Bhavna.

+5  A: 

Your approach will take too much time. I have outsourced such tasks to bulk mailing services that are white-listed, and have the capability to send out bulk emails.

If you still end up send as many emails as you mentioned, you are likely to be designated as a spammer. You should also look into whitelisting yourself.

Raj More
Give him the benefit of doubt. He might work for a government agency, for example.
DrJokepu
Whether he is a spammer or not is irrelevant. The likelihood is that he will be flagged as that by many spam filter hardware and software setups automatically, especially those at the larger web-mail hosts such as gmail.
BBlake
A: 

You could consider a flat file, and just run a bash script using a command line mail tool (pine?) to send the email to each person.

If it's already IN a database though, then you're doing it ok. Although do you have your own smtp server? Or do you use an ISP's? If so, you may wish to check with them and let them know your intent to mail, so that they're aware it's not jus spam.

Mark Mayo
+1  A: 

Consider using database, then for tagged every users that are sent the the email, then process the untagged users by batch(let say 100 users per batch). In case of failure you are safe.

jerjer
+1  A: 

You should multi-thread this method. If you can send 10 emails per second (depending on your server and the SMTP server) it will take 73 hours to transmit.

james
A: 

I would suggest taking this a step further and making it distributed in a coarse grained sense. Your current approach is fine, but I would have a stored procedure which returns back which 100 individuals to email based on some additional integer columns, say GENERATION and SENT_GENERATION. Your procedure would retrieve N rows which GENERATION != NEW_GENERATION and set their GENERATION to NEW_GENERATION. The sproc would return these N rows to the calling program which would send the emails and then update the table and set SENT_GENERATION to GENERATION so that you could tell which emails got sent, and those which did not.

A strategy like this would allow you to have multiple machines sending out emails in batches, as you could spend many days sending email to 2M people w/o threading or distributed sends.

sixlettervariables
+1  A: 

I think you should first search on google how o avoid being flagged as a spammer. 2 million emails isn't trivial.

Do you plan to send a lot of emails each day, one per month? An "email" table with the content of each sent e-mail would be interesting in this scenario.

GmonC
A: 

Hi, Thank you all for your time and reply.

We are using ISP's SMTP to send our mails.

I am sending 100 emails at a time with asynchronous email methodology. Further to it do i need to do anything?

Thanks and Regards, Bhavna.