Page 1 of 1
Bulk Mailer
Posted: Wed Jun 10, 2009 5:41 am
by phpengineer
Hi Friends,
I would like to create a Bulk Mailer tool in my site. Anyone has experience in such a tool?
My purpose is to send hundreds of mails
at once.
Can I use
phpmailer class for this?
Any problem looping 100 times and sending mail in each loop?
Thanks in advance,
PHPEngineer
Re: Bulk Mailer
Posted: Wed Jun 10, 2009 7:20 am
by omniuni
This is actually a pretty good question.
Short answer:
Sure, you can simply loop through your eMail addresses and send the mails, BUT you may run in to memory limits, or bulk eMail limits depending on your server configuration, and how many mails you are trying to send.
Long answer:
Probably the best way to do this is to create a PHP script that runs as a chron job. Use a database and when you need to send a bulk eMail, write the entries to the database, each one with the information required for the mail. Every so often, have your automated script run, and batch the next several mails in the DB. Mail won't go out instantly, but if your chron runs every 2 minutes, say, and mails 20 emails in a go, it would take about 10 minutes to send about 100 mails. You could handle 600 in an hour, which is not too shabby, and it would greatly decrease your servers load.