4

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?

Egidio Caprino
  • 553
  • 10
  • 18
  • Not sure your params are ok. Check similar questions, e.g. this [one](http://stackoverflow.com/questions/1094137/zend-mail-gmail-smtp) or others. – Marcin Aug 12 '11 at 11:30

1 Answers1

10

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);
David Snabel-Caunt
  • 57,804
  • 13
  • 114
  • 132