0

I'm building an internal web-application in PHP that needs the ability to mail. I've used the code listed here:

Send email using the GMail SMTP server from a PHP page

and it works like a charm, when I run it from my house.
However, when I run the code from the office, I get the following:

Failed to connect to ssl://smtp.gmail.com:465 [SMTP: Failed to connect socket: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (code: -1, response: )]

Any idea how to get around this?
Thanks,
-JWW

Community
  • 1
  • 1
JWally
  • 582
  • 11
  • 18

2 Answers2

0

It's most probably a firewall at your workplace blocking outgoing connections to port 465. Did you try port 587 instead?

ziad-saab
  • 19,139
  • 3
  • 36
  • 31
0

I agree with the responder above - this is most likely a firewall blocking outbound connections on port 465. You can either try TLS connection on port 587 or port 25 per Gmail's troubleshooting docs : http://support.google.com/mail/bin/answer.py?hl=en&answer=78775

If you are unable to get around this (if IT will not remove the blocks for example), you could try a third party API as a proxy. Our product http://PostageApp.com can use external mailservers such as Gmail, in addition to our own MTA, and communication is all through standard http REST calls, avoiding the firewall issue.

We're a paid service but have a free plan as well...if you would be sending more email than our free plan allows for (100/day), then you'll probably fall foul of Gmail's sending limits anyway which restrict third party clients to about 100/day outbound.

http://help.postageapp.com/kb/quick-start-guides/php

Disclaimer: I work for PostageApp

tomwalsham
  • 781
  • 4
  • 4
  • Tom, thanks for the tip. I'm trying to get everything configured on my end for your service, and I think I'm running into problems with cURL. I'm behind a corporate proxy which appears to be using a proxy authentication script. Do you have any tips? Thank, JWW. – JWally Jun 01 '12 at 20:23