Hi all, i am trying to send an email using zend mail with gmail smtp. Upon clickin on my action to send mail, my application just returns the following error " Unable to connect via TLS". So i tried SSL on port 465 and that returns an error as well saying "could not open socket". Can anyone tell me what I am doing wrong and how to solve this?
My code for sending the mail is as follows:
require_once 'Zend/Mail.php';
$smtpServer = 'smtp.gmail.com';
$username = 'example@example.com';
$password = 'secret';
$config = array('ssl' => 'tls',
'port' => '587' ,
'auth' => 'login',
'username' => $username,
'password' => $password);
$transport = new Zend_Mail_Transport_Smtp($smtpServer, $config);
$mail = new Zend_Mail();
$mail->setFrom('example@example.com', 'Some Sender');
$mail->addTo('reciever@reciever.com', 'Some Recipient');
$mail->setSubject('Test Subject');
$mail->setBodyText('This is the text of the mail.');
$mail->send($transport);