Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP send mail on windows causing it to 'hang' after sending email

we're starting to build a web app. My colleague is developing on linux, and I am running via a WAMP stack running windows xp. We're using Zend.

When we submit a form and send an email using Zend email, the email would send and then I would get a blank screen, wheras on the linux machine the app would continue normally.

So I wrote my own little script, mail.php which uses phpmailer - and the exact same thing happens, the email sends, and then blank screen. So we have:

if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent";
}

So there is no error reported, the email sends, but "Message has been sent" never prints to the screen (or anything else, normal HTML too).

I am not very technical, so apologies if there are obvious debug steps to take. Is there something peculiar to windows php config that I have missed?

It's an off-site SMTP server with authentication.

like image 264
Dave Avatar asked Oct 27 '22 02:10

Dave


2 Answers

Sounds like you are getting an error, but just not seeing it. Make sure you have this somewhere in your code

ini_set( 'display_errors', 1 );
error_reporting( E_ALL );

And inspect your apache logs for 500 errors as well.

like image 114
Peter Bailey Avatar answered Nov 02 '22 07:11

Peter Bailey


PHP has it's own error log, when in doubt check there. You should be able to locate it by running

<?php
phpinfo();
?>

It should be located in the PHP Core section - if it's blank, edit your php.ini file and turn log_errors on and specify where you want the file to be.

Errors I couldn't get to display I've found using this.

UPDATE

Did some digging and it seems that Zend_Mail is essentially a wrapper for PHP's mail() function according to the documentation: http://framework.zend.com/manual/en/zend.mail.html

With that in mind there's some information on PHP's mail() function in the PHP manual that you're going to want to look at regarding SendMail http://www.php.net/manual/en/ref.mail.php the first comment on the page (as of this writing) has all the details on configuring your WAMP server to behave like a *nix server - at least as far as mail() operations go ;-)

like image 45
Crazy Joe Malloy Avatar answered Nov 02 '22 08:11

Crazy Joe Malloy