这是我的代码:
$config = array(
'ssl' => 'tls',
'port' => 587,
'auth' => 'login',
'username' => 'test@gmail.com',
'password' => 'test');
$mail = new Zend_Mail('UTF-8');
$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
$mail->setBodyHtml('test');
$mail->setFrom('test@gmail.com', 'thrth');
$mail->addTo('test@mail.com', 'thr');
$mail->setSubject('test');
$mail->send($transport);
但有一条错误消息:
Could not open socket
我使用 CentOS 6.5 x86_x64 最低版本和 Oracle VM VirtualBox。
最佳答案
您可以尝试将端口更改为 465 吗?
关于php - [Zend框架1]使用gmail发送邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26268119/