Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:
01-23-2011, 07:28 AM, (This post was last modified: 01-23-2011, 07:36 AM by RVC Video Chat.)
#1
Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:
If your software, using PHPMailer to send out messages via gmail (Google Mail) account, stops working when sending mail (SMTP) and it gives an error like:

Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Connection timed out)

the possible reason is the firewall that is blocking outgoing communication on port 465.

to test if you can connect to the google smtp server, use this command (Linux shell):
Code:
openssl s_client -connect smtp.gmail.com:465
*if nothing happens for a long time, than you get a "connection timed out" message, it may be the firewall

SOLUTION: This solution will work on cPanel/WHM powered servers with CSF (ConfigServer Security&Firewall) *on other servers use SSH and vi to edit CSF and restart the service after making the changes
  • Log into WHM as root and access "ConfigServer Security&Firewall" settings (on left, at the bottom, under Plugins)
  • Click "Firewall Configuration" button
  • Find: # Lists of ports in the following comma separated lists can be added using a colon (e.g. 30000:35000).
  • Under "# Allow outgoing TCP ports"
    check the "TCP_OUT =" list if you see port 465 listed (usually between port 443 and 587). If not:
  • include port 465 in the list, scroll down and click "Change"
  • restart CSF firewall

test if you can connect to the google smtp server again:
Code:
openssl s_client -connect smtp.gmail.com:465
*you should see a certificate and you are connected. If this is the case, the firewall was the cause

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)