CodeIgniter Forums
SMTP gmail help - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: SMTP gmail help (/showthread.php?tid=32454)



SMTP gmail help - El Forum - 07-23-2010

[eluser]blorriman[/eluser]
I apologize if I missed a thread in the forum, but I read through some of them and didn't find the answer I was looking for.

On my local server (localhost), my config/email.php is as follows, and it works great:
Code:
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'mypassword';
$config['newline'] = "\r\n";

But when I upload that to my host server I get the following error :
Quote:Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Permission denied)

Filename: libraries/Email.php

Any explanation/help would be greatly appreciated.


SMTP gmail help - El Forum - 07-23-2010

[eluser]pickupman[/eluser]
Sound like your host maybe blocking that port. Open a ticket or a chat with them. Googling shows then need to have openssl enabled for php. You could check your config with a phpinfo();


SMTP gmail help - El Forum - 07-25-2010

[eluser]kbauman[/eluser]
Here was my solution to using gmail. I had everything correct, but it wouldn't work until I added the following:
Code:
$config['smtp_timeout'] = 30;
$config['newline'] = "\r\n";
$config['crlf'] = "\r\n";
$config['mailtype'] = 'text';
$config['charset'] = 'utf-8';

I don't know which of those things made it work...I'm just happy it finally works.