Just configure PHP's sendmail_path directive to be:
sendmail -t -i -Odeliverymode=q
That means any use of the mail() function will simply stick the message in
the outgoing queue. You can then configure sendmail to run periodically
to process this queue.
Basically: man sendmail
On Sun, 30 Sep 2001, P.Agenbag wrote:
> Hi, I'm not sure this is the right list to post this, and i'm not even
> sure if there is already a solution to this problem, in which case,
> Ok, my problem: PHP has (as you all know) a mail() function which is
> very handy to send mail to people. Now, with the advent and subsequent
> ease of MySQL into the picture, anyone who have a bit of time on their
> hands and a table filled wiith e-mail addresses, can easily write a loop
> sending bulk mail or spam to thousands of users listed in the table.
> The problem with this as you might know, is that the mail() function
> seems to invoke a new sendmail process (on Unix boxes) for each mail()
> call, meaning that you can very quickly crash your sendmail if you have
> a fast enough server and a large enough list of addresses in the table.
> I know that using php to send so much mail is not the right answer, but
> there are people out there who DON'T know this, and are using this
> method, or at least trying to, causing great headaches to many
> administrators, as there is no way of preventing someone (barring a full
> on removal of the user's rights) from doing so again and again.
> Now, my question is, isn't it possible to re-write the mail function to
> instead of treating each call to the mail function as a separate event,
> to rather see it as a "global event", ie., when called, it will always
> assume that more is coming until it gets a "finished" call. This way,
> surely, it should be possible to have the entire batch sent directly to
> the mail queue instead of trying to send the messages immediately as it
> comes in, thereby clogging sendmail and causing it to shut down...
> Unfortunately, I am not a programmer, so I would not be able to help
> much when it comes to doing this, but maybe the guys working on the code
> could look into this? Like I said, I am not sure if there might already
> be another way of solving this (not third party solutions like mailling
> list managers...) but if there is, and someone reading this and knows of
> one, please post me the solution! I really need to know that a single
> user on one of my websites cannot cause the entire systems mail to clog.
> Thanks alot, and keep up the good work, PHP is still the best!
> Petre Agenbag
> South Africa
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]