[Zend Framework 1]使用gmail发送邮件

时间:2022-02-20 18:13:38

That is my code:

那是我的代码:

$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);

But have one error message:

但是有一条错误消息:

Could not open socket

无法打开插座

I use CentOS 6.5 x86_x64 minimal with Oracle VM VirtualBox.

我使用CentOS 6.5 x86_x64 minimal与Oracle VM VirtualBox。

1 个解决方案

#1


-1  

Can you try changing the port to 465?

你能尝试将端口更改为465吗?

#1


-1  

Can you try changing the port to 465?

你能尝试将端口更改为465吗?