Welcome Guest, Not a member yet? Register   Sign In
Gmail SMTP using SSL/TLS

This may or may not be the right place to post this. But I will anyway.

I have always thought running your own mail server is a pain, and I always thought using Gmail to send email for your site was only ok for small sites.

I recently discovered this company http://www.sendgrid.com and have been very happy with them so far.

Thank you SO MUCH for this! Fixed an issue I've been having for months.

Great post/tutorial, thanks for posting it - might come in handy some day Smile

good job wrs!!
it works! :-)

hi all,

im using almost similar code but mine is not working.. im testing it on my real server.here is my code:


class Test2 extends Controller{

function __construct()

function index()
$data['pagetitle'] = 'Account Activation';
$email = $this->load->view('test1',$data,TRUE);

$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'mypasswordhere',
'mailtype' => 'html',
'wordwrap' => TRUE
$this->load->library('email', $config);

$this->email->from('[email protected]', 'farah');
$this->email->to('[email protected]');

$this->email->subject(' Testing testing testing....');

if (!$this->email->send()):

echo 'Your e-mail has been sent!';

i already set my pop3 setting in gmail.but stl got the error.pls someone help me~

fsockopen() [function.fsockopen]: unable to connect to smtp.googlemail.com:465 (Connection timed out)

how to check the openSSL is enabled..

Thanks a lot!
It's really a very helpful post!
It solves the problem which i'm working on!
Thousand thanks!

This was very helpful, and much better than replacing the Email.php library with Swiftmailer, thank you!

Thank you for sharing the codes. I did the same thing and I got some errors, I found in this line, thanks for sharing this correct code.

$this->load->library(‘email’, $config);

Bob M.

[quote author="miss_amylee" date="1272290048"]how to check the openSSL is enabled..[/quote]
enable SSL in your PHP config. Load up php.ini and find a line with the following:


Theme © iAndrew 2016 - Forum software by © MyBB