开发者

.NET Service Application – Sending mail to 2,634,789 users

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.


Thank you all for your time a开发者_C百科nd 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.


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.


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.


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.


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜