简体   繁体   English

PHP 错误 500 发送邮件

[英]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.我在这里遇到了问题,希望您能帮忙,我有一个使用 iis6 和 php 的 Web 服务器,php 配置设置为使用我的 sbs2008 SMTP 服务器发送电子邮件。

My problem is that about 7 times out of 10 the email fails but sometimes it works fine.我的问题是,大约 10 次电子邮件中有 7 次失败,但有时它可以正常工作。 I've actually got owncloud setup but when it comes to sending an email its very intermittent.我实际上已经设置了 owncloud,但是在发送电子邮件时,它非常断断续续。

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我知道这与 Owncloud 无关,因为我有一个小的 php 邮件测试脚本,它只发送电子邮件 - cloud.codeman.org/mailtest.php 但有时你会看到我收到 500 错误,有时测试电子邮件发送,让我发疯:-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. PS我使用带有PHP的Windows 7 IIS6并使用SMTP将邮件发送到SBS2008以传递给我的网站主机以将邮件发送到外界。

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?如果您不知道它的路径,请参阅PHP 将错误日志存储在何处? (php5, apache, fastcgi, cpanel) (php5, apache, fastcgi, cpanel)
AND
wrap the mail function in an if block to see if it was executed successfully.将邮件函数包装在 if 块中以查看它是否成功执行。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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