[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1493
  • Last Modified:

PHP - fsocket connections failing (time out), not sure why...

Hi,

I am attempting to deliver emails directly by connecting to my recipients smtp server.

However when the script tries to connect to googles mail servers it times out. Can anyone see why?

Warning: fsockopen() [function.fsockopen]: unable to connect to alt2.aspmx.l.google.com:25 (Connection timed out) in /smtpSend.php on line 89

Warning: fsockopen() [function.fsockopen]: unable to connect to alt3.aspmx.l.google.com:25 (Connection timed out) in /smtpSend.php on line 89

Warning: fsockopen() [function.fsockopen]: unable to connect to alt4.aspmx.l.google.com:25 (Connection timed out) in /smtpSend.php on line 89

Warning: fsockopen() [function.fsockopen]: unable to connect to aspmx.l.google.com:25 (Connection timed out) in /smtpSend.php on line 89

Warning: fsockopen() [function.fsockopen]: unable to connect to alt1.aspmx.l.google.com:25 (Connection timed out) in /smtpSend.php on line 89

Open in new window


array(2) { ["mx"]=> array(5) { [0]=> string(23) "alt2.aspmx.l.google.com" [1]=> string(23) "alt3.aspmx.l.google.com" [2]=> string(23) "alt4.aspmx.l.google.com" [3]=> string(18) "aspmx.l.google.com" [4]=> string(23) "alt1.aspmx.l.google.com" } ["weight"]=> array(5) { [0]=> int(30) [1]=> int(40) [2]=> int(50) [3]=> int(10) [4]=> int(20) } } 

Open in new window


foreach($mxhosts['mx'] as $smtp_host){
    if($socket = fsockopen($smtp_host, 25, $errno, $errstr, 20) )
    {
        break;
    }
}

Open in new window

0
mhdi
Asked:
mhdi
  • 2
1 Solution
 
Ray PaseurCommented:
Where are Google's instructions that tell how to connect to its mail servers?  Can you post a link for us?  Thanks, ~Ray
0
 
mhdiAuthor Commented:
I found the issue. It was my hosting providers firewall blocking outbound connections initiated by PHP on port 25
0
 
mhdiAuthor Commented:
Hosting provider issue found.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now