开发者

Send mail with Zend_Mail through Gmail smtp server

I'd like to use Gmail smtp server to send e开发者_如何转开发mail 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?


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜