Saturday, 10 May 2014

How to sending thousands of emails from your server to your subscription list.

OK I wrote one for work and it sends about 10 million emails a month.

First you need to know and understand that php can write command line programs

1) You need to have a subscription database with email addresses of those that you will email

2) You need a table called for example eBlastAddresses that table just needs a UID, the id of the email that will be sent and the email address it will go to.

3 Write a script that will do the following steps

a) Check if any email addresses are in the eBlastAddresses table for the email you want to send if none exist then extract out of your subscription list the list of emails address to send and put them in the eBlastAddresses table.

b) Write a loop that will extract the next 1000 emails to send then, mark them as processing and send them

c) When the 1000 have been sent then delete all those marked as processing from the eBlastAddresses table. then go to step b

d) When all emails have been sent end program

Job done.

It takes about 4-5 hours from memory to send 300k emails.

If the job crashes you can just restart and extract the next 1000 emails this will mean that you won't be sending multiple emails to people if it crashes and you have to start it again.

No comments:

Post a Comment