简体   繁体   中英

PHP error 500 sending mail

I'm having a problem here I hope you can help with, I've got a web server using iis6 and php, php config is setup to use my sbs2008 SMTP server to send email.

My problem is that about 7 times out of 10 the email fails but sometimes it works fine. I've actually got owncloud setup but when it comes to sending an email its very intermittent.

I know this is nothing to do with Owncloud as ive got a small php mail test script that just sends emails - cloud.codeman.org/mailtest.php but you will see sometime i get 500 error and sometimes test email sent, driving me crazy :-x

I wonder if there's a way to diagnose what's happening or if someone has seen this before.

Cheers Mark

PS im using Windows 7 IIS6 with PHP and sending mail to SBS2008 using SMTP to pass to my website host to get the mail to the outside world.

You should check your error log, when you get the "Internal Server Error", usually error log points you in the right direction.
If you don't know its path, see Where does PHP store the error log? (php5, apache, fastcgi, cpanel)
AND
wrap the mail function in an if block to see if it was executed successfully.

if(!mail($to, $subject, $msg, $headers)){
  echo error_get_last();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM