通过Gmail smtp服务器与Zend_Mail发送邮件 [英] Send mail with Zend_Mail through Gmail smtp server
本文介绍了通过Gmail smtp服务器与Zend_Mail发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望使用 Gmail smtp服务器通过 Zend_Mail 发送电子邮件。我有这样的代码
I'd like to use Gmail smtp server to send email with Zend_Mail. I had this code
Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Smtp("smtp.googlemail.com", array(
"auth" => "login",
"username" => "myusername@gmail.com",
"password" => "mypassword",
"ssl" => "ssl",
"port" => 465
)));
但是当我尝试发送一封电子邮件时,它会抛出一个带有拒绝连接。
but when I try to send an email it throws an Exception with message Connection refused.
我在哪里弄错了?
Where I'm wrong?
推荐答案
params是错误的。给它一个这样的镜头:
Your params are wrong. Give it a shot with these:
$config = array(
'ssl' => 'tls',
'port' => 587,
'auth' => 'login',
'username' => 'myusername@gmail.com',
'password' => 'mypassword'
);
$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
Zend_Mail::setDefaultTransport($transport);
这篇关于通过Gmail smtp服务器与Zend_Mail发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文