【发布时间】:2016-10-05 11:16:10
【问题描述】:
我发现自己升级到php5.6后无法发送邮件了。
$to = "Test1 <*******@gmail.com>";
$body = "Hi,\n\n this is just test email";
$headers = array(
'From' => '*******@gmail.com',
'To' => $to,
'Subject' => 'test email'
);
$smtp = Mail::factory('smtp', array(
'host' => 'smtp.sendgrid.com',
'port' => '587',
'auth' => 'login',
'username' => '*****',
'password' => '*****',
));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo $mail->getMessage();
} else {
echo "<p> Message successfully sent!</p>";
}
登录验证失败[SMTP:STARTTLS 失败(代码:220,响应:立即开始 TLS 协商)]
如果我通过此代码使用我的 Gmail 帐户,我也会收到错误
$smtp = Mail::factory('smtp',array (
'host' => 'ssl://smtp.googlemail.com',
'port' => '465',
'auth' => 'login',
'username' => '******@gmail.com',
'password' => '*******'
));
身份验证失败 [SMTP:从服务器收到的响应代码无效(代码:534,响应:5.7.14 请通过 Web 浏览器登录,然后 5.7.14 再试一次。5.7.14 了解更多信息,请访问 5.7.14 @987654321 @jz4sm22875767wjb.16-gsmtp)]
我有一个用 ZF1 运行的 oid 应用程序,我发现这个调用 Zend_Mail_Protocol_Smtp 有问题:
stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)
我读到 php 5.6 对 OpenSSL 进行了一些更改,但我不知道我需要做哪些更改。
【问题讨论】:
-
您找到解决此问题的方法了吗?我正在经历同样的问题..谢谢