$config = array('ssl' => 'tls',
'port' => 587,
'auth' => 'login',
'username' => '****@gmail.com',
'password' => '****');
$tr = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
$mail = new Zend_Mail();
$mail->setBodyText($this->_request->getPost('body'));
$mail->setFrom('****@gmail.com');
$mail->addTo($this->_request->getPost('to'), 'receiver1');
$mail->setSubject('TestSubject');
if ($mail->send($tr))
echo "Mail Sent Successfully";
else
echo "Mail was not sent";
我收到此错误消息:
消息:无法通过TLS连接
答案 0 :(得分:0)
您需要在PHP中使用SSL扩展。
转到服务器上的php.ini
文件,找到extension=php_openssl.dll
并取消注释