Bulk Mailer

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phpengineer
Forum Newbie
Posts: 5
Joined: Wed Jun 10, 2009 5:31 am

Bulk Mailer

Post 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? :roll:

Any problem looping 100 times and sending mail in each loop?

Thanks in advance,
PHPEngineer
User avatar
omniuni
Forum Regular
Posts: 738
Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA

Re: Bulk Mailer

Post 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.
Post Reply