phpmailer/IsSMTP导致500错误,但1分钟后发送邮件 [英] phpmailer / IsSMTP causes 500 error but sends the mail 1 minute later

查看:249
本文介绍了phpmailer/IsSMTP导致500错误,但1分钟后发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当$ mail-> isSMTP()时;在phpmailer中设置,它挂起"大约1分钟,然后重定向到: XID为2060448470的500服务不可用页面.

whenever $mail->isSMTP(); is set in phpmailer it "hangs" for about 1 minute, then it redirects to a: 500 Service Unavailable page with XID: 2060448470.

但是一分钟后,我得到了发送的邮件.在邮件中,我可以阅读: 收到的SPF:通过(google.com:admin@skivbasar.se的域将2a00:16d8:0:4 :: 200指定为允许的发件人)

BUT one minute later i GET the mail that was sent. in the mail i can read: Received-SPF: pass (google.com: domain of admin@skivbasar.se designates 2a00:16d8:0:4::200 as permitted sender)

当我删除"$ mail-> isSMTP();"时立即发送电子邮件,但没有SPI =通过: spf = none(google.com:117658@atapa01.citynetwork.se未指定允许的发件人主机).

When i remove "$mail->isSMTP();" the email get sent right away BUT they dont get SPI = pass: spf=none (google.com: 117658@atapa01.citynetwork.se does not designate permitted sender hosts).

我真的需要SMTP才能正常工作,因为过去我丢失了很多邮件.我花了几天的时间来寻找解决方案,其中包括20多个关于stackoverflow的文章.

I really need SMTP to work since i got a lots of lost mails in the past. I've spent several days looking for a solution including 20+articles here on stackoverflow.

我已经从worxware和github重试了几次示例代码.始终为"$ mail-> isSMTP();"拒绝正确地工作.

I've re-tried the sample code several times from both worxware and github. It's always "$mail->isSMTP();" that refuses to work propperly.

这是我的电子邮件代码:

Here is my mail code:

require("PHPMailerAutoload.php");
require("class.phpmailer.php");
require("class.smtp.php");

$mail = new PHPMailer();
$mail->Host = "mail.skivbasar.se";
$mail->Port = 587;
$mail->SMTPAuth = true;    
$mail->SMTPSecure = "ssl";
$mail->IsSMTP();   
$mail->Username = "-----.se";  // SMTP username
$mail->Password = "-------"; // SMTP password
$mail->AddReplyTo($replyto);
$mail->From     = "admin@skivbasar.se";
$mail->FromName = "skivbasar.se";
$mail->AddAddress($row['email']);
$mail->Subject  = $row['subject'];
$mail->Body     = $row['message'];
$mail->WordWrap = 150;

if(!$mail->Send()) {
    $error = true;
} else {

    $error = false;
}

您可以在以下位置访问测试页以查看操作中的错误: http://skivbasar.se /action/mail/t3.php

you can access a testpage to see the error in action at: http://skivbasar.se/action/mail/t3.php

UPPDATE:

非常感谢您回复同步!您似乎是一名真正的phpmailer专家!

Thank you so much for replying Synchro! You seem to be a real phpmailer expert!

我已经尝试了无数次tls和ssl,甚至注释了该行,并同时使用了端口587和465.只要"isSMTP"是有效的,两者实际上都可以发送邮件.

i've tried both tls and ssl countless times and even commenting the line and using both port 587 and 465. Both actually works to send mail as long as "isSMTP" is of.

我要解决的真正问题是,为什么每当设置"isSMTP"时脚本都会挂起1分钟,但是在重定向到500页后仍然发送邮件.

The real problem i'm trying to solve is why the script hangs for 1 minute whenever "isSMTP" is set but still send the mail after redirecting to the 500 page.

没有isSMTP的软件失败者是通过以下方式发送的: 来自smtp02.mailout.citynetwork.se(mailout.citynetwork.se.[91.123.193.90])

the softfail ones without isSMTP is being sent by: from smtp02.mailout.citynetwork.se (mailout.citynetwork.se. [91.123.193.90])

和通过(但被挂起)的通过以下方式发送: 来自smtp03.citynetwork.se(mail.citynetwork.se.[91.123.193.200]).

and the passed (but hanged) ones are being sent by: from smtp03.citynetwork.se (mail.citynetwork.se. [91.123.193.200]).

感觉脚本正在等待邮件服务器的答复60秒钟(例如HELO),并且服务器没有响应.它会在60分钟后仍然发送邮件.我已经在某处读到了有关此内容的信息.我还在代码中找到了一些指向"HELO"的条目,例如第1340行的class.phpmailer.php中的"//我们必须在tls协商后重新发送HELO."

Is feels like the script is waiting for a reply from the mailserver for 60 seconds (like a HELO) and when the server does not respond. it send the mail anyway after 60 minutes. I've read about this somewhere. I also found some entries in the code where it refers to "HELO" like in class.phpmailer.php on line 1340 "// We must resend HELO after tls negotiation".

由于它被重定向到500页,因此我无法打印任何错误消息.我也无权访问我的日志.但是它可以在本地主机上与"isSMTP"一起使用,仅当脚本在线运行时才这样挂起.

Since it's redirect to a 500 page i cant print any error messages. I also dont have access to my log. But it works with "isSMTP" on localhost, it's only when the script is run online is hangs like this.

推荐答案

我遇到了同样的问题,在$ mail-> send()上获得了500的响应,但是在按照Synchros的建议查找phpMailers gmail示例之后,我使用了

I had the same problem, getting 500 respone on my $mail->send(), but after following Synchros suggestion to look up phpMailers gmail example, i used

$mail->Host = gethostbyname('mail.citynetwork.se');

代替

$mail->Host = 'mail.citynetwork.se';

这解决了我的问题.

这篇关于phpmailer/IsSMTP导致500错误,但1分钟后发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆