phpzend-frameworkzend-mail

Zend Mail using gmail SMTP


There are like 1000 posts on this, but somehow I cant get things to work. I use

$config = array('ssl' => 'tls',
            'auth' => 'login',
                'port' => 587,
                'username' => 'myusername@gmail.com',
                'password' => 'mypassword');

$tr = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);

and get a

Fatal error: Uncaught exception 'Zend_Mail_Protocol_Exception' with message 'Unable to connect via TLS'

Using

$config = array('ssl' => 'ssl',
                'auth' => 'login',
                'port' => 465,
                'username' => 'myusername@gmail.com',
                'password' => 'mypassword');

$tr = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);

I am getting

Fatal error: Uncaught exception 'Zend_Mail_Protocol_Exception' with message 'Could not open socket'

Btw, I am using xampp 1.7.7. Any help anyone?


Solution

  • I'm pretty sure Gmail doesn't allow SSL/TLS. If you remove that line I believe the config above should work, assuming correct username and password.