I am sending mail using smtp options. When I sent mail via ssl it is working fine. But when I tried to send mail via tls, it is not working properly. My application is in CakePHP 1.3.
function testemail() {
$from = '[email protected]';
$this->Email->delivery='smtp';
$this->Email->smtpOptions = array(
'port'=>'portnumber',
'auth' => true,
'host' => 'tls://smpt.xxxx.com',
'username'=>'[email protected]',
'password'=>'xxxxxxxxx',
);
$this->Email->to = '[email protected]';
$this->Email->subject = 'Test Email';
$this->Email->from = $from;
$this->Email->replyTo = $from;
$this->Email->return = $from;
$this->Email->additionalParams = '-f'.$from;
$this->Email->sendAs = 'html';
$this->Email->template = 'template';
$this->set('template','Testing TLS mail');
if($this->Email->send()) {
$this->Session->setFlash(__('Mail sent.', true));
} else {
$this->Session->setFlash(__('Error.', true));
}
}
Thanks
try this alternative if your server supports SSL: