Re: Re: mail() takes too much time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Colin Guthrie wrote:
Stut wrote:
Matthew Lasar wrote:
I run pretty simple mail group distribution program that uses
php/mysql and the mail() function. I adapted it from an open source
script. Most of the time it runs well. But it does take a while to run
through all 150 members of the list. So I'm half glad that I don't
have a list of 1000 people or more.

Any way to optimize the mail function in terms of speed? Probably too
vague a question, sorry.
Don't use the mail function. On a unix-based system it will pass the
message directly to sendmail which will attempt to deliver the message
in realtime. When you're sending a large amount of mail that sucks.

Your best option is to switch to using a system that connects to the
SMTP server on localhost directly. That way you can dump each message on
to the local MTA quickly and then forget about it.

I don't think this is correct, at least on my system. I know this
because I deliberatly ban internal machines on my network from
delivering mail to outside server (internal LAN cannot connect to port
25 on any system other than our gateway - this is to stop any windows
machines that may sneak into my network from spamming the world!).

When I test web apps locally I have to watch to override email addresses
such that I don't try to sent to real people but when I forget, they all
end up stuck in my local machine's MTA. So for that reason, mail() must
speak to my MTA, not try to deliver directly. Perhaps it depends on your
sendmail implementation? I prefer postfix (which has a sendmail
compatible binary). YMMV.

It depends a lot on how your machine is configured, but the way I described it is usually the way it works. Note that if sendmail cannot send the messages immediately it will pass it into the local mail queue and that's probably what's happening on your system because sendmail will find port 25 blocked.

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux