8

I run codeigniter3.03 on digital ocean nginx and php 7. When I try to send an email I get this error:

Code:

Severity: Warning Message: fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Connection timed out) Filename: libraries/Email.php Line Number: 1986

My email setup is

$config['useragent'] = 'CodeIgniter';
$config['protocol'] = 'smtp';
//$config['mailpath'] = '/usr/sbin/sendmail';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_user'] = 'xxxxxx@gmail.com';
$config['smtp_pass'] = 'xxxxxxxxxxxx';
$config['smtp_port'] = 465; 
$config['smtp_timeout'] = 5;
$config['wordwrap'] = TRUE;
$config['wrapchars'] = 76;
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['validate'] = FALSE;
$config['priority'] = 3;
$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
$config['bcc_batch_mode'] = FALSE;
$config['bcc_batch_size'] = 200;

This version runs flawlessly in the same config under php 5.x.

in php.ini i have

 extension=php_openssl.dll

enabled.

I could not get any hint anywhere why this should not work in php7. Can anybody give me a hint what to check or what the cause of this error could be.

Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
elf
  • 113
  • 5
  • 1
    "timed out". something prevent a network connection from being established. firewall or other network-level thing, maybe. – Marc B Feb 22 '16 at 19:40
  • What exact version of PHP 5 do you use? – ksimka Mar 02 '16 at 10:46
  • Also, looks like you're on Windows. Have you read a note here — http://php.net/manual/en/openssl.installation.php ? – ksimka Mar 02 '16 at 10:49
  • 1
    Doesn't seem to be an SSL or a PHP version issue. Have you tried doing a socket call like this ` – R Singh Apr 30 '16 at 11:37

1 Answers1

1

Did you try smtp.googlemail.com already?

Also note this other answer, with a working example (seems to be different, for instance in the timeout definition):

Another solution:

Community
  • 1
  • 1