通过codeigniter将邮件发送到Gmail帐户失败

I tried to send a email to a Gmail account (both receiver and sender accounts were created by me and both allow access to less secured apps) via CodeIgniter, using the following settings (from my localhost WAMP sever):

$config['smtp_user']='my gmail address';
$config['smtp_pass']='my password';
$config['smtp_port']=465;
$config['smtp_host']='ssl://smtp.googlemail.com';
$config['charset']='utf-8';
$config['protocol'] ='smtp';

The code snippet looks like this :

$this->email->from(my gmail address... , 'admin');
$this->email->to($reciever_email);
$this->email->subject(...);
$this->email->message(...);
$this->email->send();

But the mail does not get send (No weird error messages like fatal error etc. is displayed only the custom message I decided to show on failure is shown).

Can any one tell me why and how to get rid of this problem.

Try this instead:

$config = Array(
         'protocol' => 'smtp',
         'smtp_host' => 'ssl://smtp.googlemail.com',
         'smtp_port' => '465',
         'smtp_user' => 'my user',
         'smtp_pass' => 'my password',
         'smtp_charset' => 'utf-8'
);