Nandini Bhaduri
Nandini Bhaduri

Reputation: 1865

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?

Upvotes: 0

Views: 16061

Answers (3)

RDK
RDK

Reputation: 4560

Try to use this config array (it works for me):

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

Upvotes: 0

encodes
encodes

Reputation: 751

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.

Upvotes: 2

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100205

Find following in the php.ini file

;extension=php_openssl.dll
//remove the semicolon in front, save and restart apache, then passed.

Hope it works for you

Upvotes: 1

Related Questions