Re: Re: mail() takes too much time
| From: | Stut | Date: | Mon, 03 Sep 2007 19:26:05 +0000 |
| Subject: | Re: Re: mail() takes too much time | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-261659@lists.php.net to get a copy of this message | ||
Colin Guthrie wrote:
Stut wrote: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/Matthew Lasar wrote: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.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.