I'm having problems with the connection to gmail.

Situation:
1. opennssl is active because options appear in the settings page
2. SMTP server : smtp.gmail.com
3. SMTP port: 465 or 587 (both tried)
4. Use encrypted protocol: SSL and TLS (both tried)
5. SMTP username: my gmail account (@gmail.com included)
6. SMTP password: my gmail account password
7. Email adress to send email to: another email adress of mine

Results:

    * warning: fsockopen(): unable to connect to smtp.gmail.com:587 in /home/vhosts/libraway.com/httpdocs/sites/all/modules/smtp/smtp.module on line 1894.
    * warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: hostname nor servname provided, or not known in /home/vhosts/libraway.com/httpdocs/sites/all/modules/smtp/smtp.module on line 1894.
    * warning: fsockopen(): unable to connect to :587 in /home/vhosts/libraway.com/httpdocs/sites/all/modules/smtp/smtp.module on line 1894.

Please, I need some help because my host doesn't allow me mail() and SMTP is the only way to go!

Comments

After researching on web, I found a clue. It is possible that a bug in php versions lower than 4.3 could cause this error... My host has v4.1 so I qualify for this possible bug...

Two questions appear:
1. Is there a possibility to avoid fsockopen() for versions of php lower than 4.3? This question stands up only if there is a real bug with fsockopen()

2. Can there be problems with host's firewall? Can this warning appear if 25, 465 or 587 ports are closed?

Status:Active» Closed (works as designed)

From the PHP manual:

As of PHP 4.3.0, if you have compiled in OpenSSL support, you may prefix the hostname with either 'ssl://' or 'tls://' to use an SSL or TLS client connection over TCP/IP to connect to the remote host.

This simply means, that below 4.3 there is no support for 'ssl://' or 'tls://'.
--
Stefan Kudwien
http://www.unleashedmind.com

I, too, am having this problem connecting to gmail. I have a duplicate install using php 5.1 and a troublesome one using 4.2.2

warning: fsockopen() [function.fsockopen]: unable to connect to smtp.gmail.com:465 in /sites/default/modules/smtp/smtp.module on line 1894.

Darn near a year and a few months later I'm having this problem also. It's not the PHP version, because the shared server I'm on is (still) using 4.3.11. If anyone has any ideas or heard of a patch being released for this, it would be awesome!

Version:5.x-1.x-dev» 6.x-1.x-dev
Status:Closed (works as designed)» Active

I am having Google host my domain's email at Google Apps.
I have chosen all of the various settings (SMTP ports & TLS/SSL) found after searching the internet. But I always get the similar errors.
After 'Save Configuration'

warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Connection timed out) in /home2/living/public_html/modules/smtp/phpmailer/class.smtp.php on line 122.
warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home2/living/public_html/modules/smtp/phpmailer/class.smtp.php on line 122.
warning: fsockopen() [function.fsockopen]: unable to connect to ssl://:465 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /home2/living/public_html/modules/smtp/phpmailer/class.smtp.php on line 122.
Unable to send e-mail. Please contact the site admin, if the problem persists.

The last line of class.smtp.php is line 122
#connect to the smtp server
$this->smtp_conn = fsockopen($host, # the host of the server
$port, # the port to use
$errno, # error number if any
$errstr, # error message if any
$tval); # give up after ? secs

I'm not finding anything that works yet.
PS: bluehost is my host, although they do not host my email (google apps does this)

Title:Problem with connection to smtp.gmail.comSample test code smtp.gmail.com

Hi

I suggest a simple test code, this would allow you to check your PHP capabilities and your hosting provider's firewall settings

<?php
$fp  
=   fsockopen("www.google.com",   80,   &$errno,   &$errstr,   10);  // work fine
 
if(!   $fp)
      echo  
"www.google.com -  $errstr   ($errno)<br>\n";
  else
      echo  
"www.google.com -  ok<br>\n";
     
$fp   =   fsockopen("smtp.gmail.com",   465,   &$errno,   &$errstr,   10);   // NOT work
 
if(!   $fp)
      echo  
"smtp.gmail.com 465  -  $errstr   ($errno)<br>\n";
  else
      echo  
"smtp.gmail.com 465 -  ok<br>\n"
     
$fp   =   fsockopen("smtp.gmail.com",   587,   &$errno,   &$errstr,   10);   // NOT work
 
if(!   $fp)
      echo  
"smtp.gmail.com 587  -  $errstr   ($errno)<br>\n";
  else
      echo  
"smtp.gmail.com 587 -  ok<br>\n";       
echo
"<br />".phpinfo();
     
?>

Thank you open-keywords.

OK, here are the results. I cannot interpret this to any meaningful results (lack of PHP knowledge). I uploaded the page temporarily to: ---------------

www.google.com - ok

Warning: fsockopen() [function.fsockopen]: unable to connect to smtp.gmail.com:465 (Connection timed out) in /home2/livingz0/public_html/test.php on line 17
smtp.gmail.com 465 - Connection timed out (110)

Warning: fsockopen() [function.fsockopen]: unable to connect to smtp.gmail.com:587 (Connection timed out) in /home2/livingz0/public_html/test.php on line 24
smtp.gmail.com 587 - Connection timed out (110)

It shows that your hosting provider is blocking the access to smtp.gmail.com on the required ports.
Your PHP version and settings looks fine.

You probably should contact their support.

I've yet to get the info from my ISP, but I'm assuming they do this to help prevent spam and such?

OK, I have my form working. I am using the Webform module http://drupal.org/project/webform. I was using the SMTP Authentication Support as well.
There were 2 things I needed to do.

  • First I needed to make sure that when I created the new MX Entries - cPanel in Bluehost.com (in order for Google Apps to host my email) that the option for:
    "Always accept mail locally even if the primary mx does not point to this server." was NOT selected.
  • Next I simply disabled the SMTP Authentication Support module.

Version:6.x-1.x-dev» 5.x-1.x-dev
Status:Active» Closed (works as designed)

Returning this issue to it's previous state.

Assigned:Unassigned» filidis
Status:Closed (works as designed)» Fixed

I had the same issue.
But the solution was very simple:
1. go to Modules>Mail: you'll see a NEW option "E-mail engine:".
2. Change it to "SMTP - SMTP mailing engine using SMTP module" and everything will work fine.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

hi
stmp modules i didn't find any "E-mail engine."
please can u help me.

hi ,

Do you got solution for

Warning: fsockopen() [function.fsockopen]: unable to connect to smtp.gmail.com:465 (Connection timed out) in /home2/livingz0/public_html/test.php on line 17
smtp.gmail.com 465 - Connection timed out (110)

Warning: fsockopen() [function.fsockopen]: unable to connect to smtp.gmail.com:587 (Connection timed out) in /home2/livingz0/public_html/test.php on line 24
smtp.gmail.com 587 - Connection timed out (110)

for this error ..

if you got solution please help me.

Priority:Normal» Critical
Status:Closed (fixed)» Active

Hi,

I am having same issue although my mail engine is SMTP and it was working fine over 1.5 years and it suddenly stopped working now. I am getting this error:

* warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Connection timed out) in /var/www/html/sites/all/modules/smtp/smtp.module on line 2069.

* warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/html/sites/all/modules/smtp/smtp.module on line 2069.

* warning: fsockopen() [function.fsockopen]: unable to connect to ssl://:465 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /var/www/html/sites/all/modules/smtp/smtp.module on line 2069.

Please let me know where is this problem cropping?

Version:5.x-1.x-dev» 6.x-1.0-beta5

hi,
have you fixed that problem, I am also getting this error.

* warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Connection timed out) in /public_html/sites/all/modules/smtp/phpmailer/class.smtp.php on line 122.
* warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in public_html/sites/all/modules/smtp/phpmailer/class.smtp.php on line 122.
* warning: fsockopen() [function.fsockopen]: unable to connect to ssl://:465 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in public_html/sites/all/modules/smtp/phpmailer/class.smtp.php on line 122.
* Unable to send e-mail. Please contact the site administrator if the problem persists.

Status:Active» Closed (fixed)

hi,
I found the solution & fixed the above issue in my site.

In my drupal installation I set Port for TLS/STARTTLS: 587 now issue fixed

reference :http://mail.google.com/support/bin/answer.py?hl=en&answer=13287

thanks,
sanjith
www.titbit.in