在本地运行时,ff代码运行得很好,问题是当上传到我们的域主机时,它会抛出此错误。
致命错误:异常'Swift_TransportException‘与消息的预期响应代码250,但得到代码"",与消息“’
我的理论是主机上的php版本没有更新。
请问问题的真正原因是什么?这是我的密码。我使用的是迅捷邮件5.1.0,本地机器的php版本是php 5.6.12
$smtp_host_ip = gethostbyname('our_domain_host.ph');
#set the transport
$emailuser1 = $_SESSION['email'];
$transport = Swift_SmtpTransport::newInstance($smtp_host_ip,587,'tls')->setUsername('username.ph')->setPassword('password');
// Mailer
$mailer = Swift_Mailer::newInstance($transport);
// Create a message
$message = Swift_Message::newInstance('Thank you for answering the survey')
->setFrom(array('username.ph' => 'Test'))
->setTo(array($_SESSION['receive_email'] => 'Receiver Name'))
->setBody($_SESSION['reply_guest']);
// Send the message
if ($mailer->send($message)) {
echo 'Mail sent successfully.';
} else {
echo 'I am sure, your configuration are not correct. :(';
}发布于 2016-01-24 08:20:21
我通过使用快速邮件记录器插件解决了我的问题。
迅捷的邮件日志插件
通过使用记录器,您可以看到错误是什么。
https://stackoverflow.com/questions/34971780
复制相似问题