Send email with gmail in the Zend framework

I am trying to send an email with a gmail account under Zend. This is what I got so far:

$mailTransport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', array( 'auth' => 'login', 'username' => ' myaddress@gmail.com ', 'password' => 'password', 'port' => '587', 'ssl' => 'tls', )); Zend_Mail::setDefaultTransport($mailTransport); $mail = new Zend_Mail(); $mail->setBodyText('This is the text of the mail.'); $mail->setFrom(' myaddress@gmail.com ', 'sender'); $mail->addTo(' reciever@gmail.com ', 'receiver'); $mail->setSubject('TestSubject'); $mail->send(); 

Using this code, I get the following error:

 Message: Unable to connect via TLS 

How can i fix this? I have installed the default installation of XAMPP without configuring SMTP in php.ini.

+4
source share
1 answer

I found a solution: I had the default php.ini settings using xampp. To connect via TLS, we need to enable OpenSSL. To enable OpenSSL, first find the php_openssl.dll file inside the xampp \ php \ ext folder. If you find this file, open the php.ini file and add the following line to it:

 extension=php_openssl.dll 

It is all to enable openssl in xampp. it allowed to send an email

+6
source

All Articles