+2  A: 
$config = Array(
    'protocol' => 'smtp',
    'smtp_host' => 'ssl://smtp.googlemail.com',
    'smtp_port' => 465,
    'smtp_user' => 'xxx',
    'smtp_pass' => 'xxx',
    'mailtype'  => 'html', 
    'charset'   => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");

// Set to, from, message, etc.

$result = $this->email->send();

Perhaps it's a good thing to post the answer you got from the CodeIgniter Forums

Thorpe Obazee
A: 

I tried the above code. It works without a problem. Check your user name and pass word

MaX
A: 

Hi

you need to enable SSL in your PHP config. Load up php.ini and find a line with the following:

;extension=php_openssl.dll

uncomment it. :D

Cerebro
A: 

Hi i tried this code but I got the following error:

Error: E_WARNING
Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:465 (Connection refused)

Do you have any idea why is this?I have tried also using phpmailer and still the same error (Connection refused)

kaloian
A: 

Thanks a lot, i've been trying this one and Cerebro's solution to remove the comment on php.ini works

harvz
A: 

I have tried to uncoment but still have error..

Severity: Warning

Message: fsockopen() [function.fsockopen]: SSL: connection timeout

Filename: libraries/Email.php

Line Number: 1652

A PHP Error was encountered

Severity: Warning

Message: fsockopen() [function.fsockopen]: Failed to enable crypto

Filename: libraries/Email.php

Line Number: 1652

A PHP Error was encountered

Severity: Warning

Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:465 (Unknown error)

Filename: libraries/Email.php

Line Number: 1652

Togu