When I execute my email script via browser a timeout fatal error is returned (unless I drastically increase the execution time, then it will run ok, not the solution I’m looking for). The email is sent tho, but it takes forever (5 min. average) to arrive (at my inbox)!
(Considering that via command line it works perfectly I think that SMTP at php.ini is certainly well configured.)
So this is the code executed by browser request:
<?php
mail('amatos@example.com', 'test subject', 'test body', 'From: Andre Matos <amatos@example.com>');
?>
and when I run this same (is it really the same? I’m starting to doubt myself) code via command line:
php -r "mail('amatos@example.com', 'test subject', 'test body', 'From: Andre Matos <amatos@example.com>');"
it works perfectly! The script runs, it stop and the email arrives instantly (2/3 seconds).
So, what can cause this difference and how to fix it? Any ideas?
Thanks in advance.
[edit] some extra info:
– the machine is windows
– the server is localhost
– php.ini is the same for both the browser and the cli instance
[edit2]
Thank you all for trying to guess which was the problem. I placed the question hopping that someone had the problem before and knew of something specific. Given nothing specific showed up and none of the suggestions really worked, I’ve decided to accept the one that allowed me to reach more conclusions about the problem… +1 For all your helpful knowledge/thoughts (/guesses) 🙂
I’ve hypothesised some couses, but I used to linux and on windows I can olny guess: