Forum Moderators: coopster

Message Too Old, No Replies

PHP mail() slow ... painfully slow

The PHP mail() function isslow to execute

         

jomoweb

11:31 pm on Jan 25, 2005 (gmt 0)

10+ Year Member



I am running some php scripts, and just about any page that sends mail with mail() loads painfully slow. Everything works in the end, but some pages can take up to 5 minues to load. Any ideas on what the problem is and how I can speed things up?

Here is the phpinfo();
(Local Values are same as master)

PHP Version 4.3.4
sendmail_from webmaster@my-isp-domain.com
sendmail_path no value
SMTP mail.my-isp-domain.com
smtp_port 25

jomoweb

8:00 pm on Jan 26, 2005 (gmt 0)

10+ Year Member



I have pretty much come to conclusion that all the settings are right, but mail() is just slow. Are there any ways to tweak the php code to speed things up?

jatar_k

8:19 pm on Jan 26, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



trouble is it is probably just your smtp server on that machine that is slow. So you would need to tweak the mail server itself is my guess.

another option is to time the script itself. Time the total time it takes as well as just timing how the long the mail function takes to return.

we have done things like write to file and send using a cron to eliminate these types of problems. We also write directly to the mail queue, though this still takes time. I have also only done that on *nix based systems.

bcolflesh

8:27 pm on Jan 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is this a virtual hosting environment? Many hosts purposely limit the SMTP speed so hit & run spammers get frustrated and pass them by.

jomoweb

8:56 pm on Jan 26, 2005 (gmt 0)

10+ Year Member



It is a virtual windows IIS hosting scenario. If the host slowed down their SMTP purposely, they haven't told me about it when I asked them about this problem. I have seen it takes about 2-5 minutes (some customers even said up to 30) for the processing of 2 emails.

The write to file/queue methods sound interesting. I have not found much documentation on how to do this on the web. Know of any tutorials or code examples for windows?