I use this method and it works for me:
$config = array(
'protocol' => 'smtps',
'smtp_host' => 'ssl://smtps.googlemail.com',
'smtp_user' => DONOT_EMAIL,
'smtp_pass' => EMAIL_PASSWORD,
'smtp_port' => '465',
'mailtype' => 'html',
'smtp_timeout' => '4',
'newline' => "\r\n"
);
I used this code for the server. Make sure every time you use the mail features on a local or server. Initialize first like this:
$this->email->initialize($config);
source
share