mailing quickly with PHP

I had a mailing list with 115+ subscribers that took well over a minute to send using PHP’s mail function. That was far too long to wait so I began searching for a way to speed it up. I was surprised at how little information there was describing straightforward methods to speed up the process of sending out e-mails. It’s possible that people want to keep the information from potential spammers, but from what I’ve seen in my inbox, they figured that problem out a long time ago, so here’s what I found.

I finally ended up doing what was described on a NY PHP mailing list and it’s not the cleanest solution because you have to edit php.ini, but it now takes about 3-4 seconds to send out all the e-mails. My default queue is configured to flush every 30 minutes.

I also found some useful commands to manage sendmail. I was already aware of mailq which shows the e-mails in the mail delivery queue, but I wasn’t aware of the client mail queue, viewed with mailq -Ac. To flush the queue manually, you can use sendmail -q, and to flush the client mail queue, sendmail -Ac -q. I wasn’t able to add that last part into my script because it has to be run as root, but it doesn’t really matter to me that the notifications won’t be sent out for a half hour. We’re not talking urgent business here.

By the way, if you do use this information to send out spam, you are a low-life who deserves to be thrown in jail with the rest of them.

Here are the links I found useful during my research.

Devshed
Devshed 2
Devshed 3
Devshed 4
Devshed 5
Devshed 6
Devshed 7
Webmaster world
PHP Help
NYPHP
Zend
Zend 2

Comments are closed