Hi i am trying to send mail in cakephp
but getting below error message:
stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol stream_socket_client(): Failed to enable crypto stream_socket_client(): unable to connect to ssl://smtp.gmail.com:25 (Unknown error)
And here is my controller
code:-
public function contact(){
//$this->loadModel('Contact');
if($this->request->is(array('put','post'))){
$this->set('data', $this->request->data);
$this->Email->from = $this->data['Page']['email'];
$this->Email->to = '[email protected]';
$this->Email->subject = 'Contact';
$this->Email->template = 'contact';
$this->Email->sendAs = 'html';
$this->Email->smtpOptions = array(
'post'=>465,
'host'=>'ssl://smtp.gmail.com',
'username'=>'[email protected]',
'password'=>'123456',
'client'=>'gmail.com');
$this->Email->delivery = 'smtp';
//$this->Email->send();
if($this->Email->send()) {
$this->redirect(array('controller'=>'pages','action'=>'index'));
}
else{
CakeLog::write('debug', $this->Email->smtpError);
}
}
}
there should be 'port'=>465 not 'post'=>465 . please correct