This Question have 2 answers right now.

PHPMailer, fsockopen(), possible Apache issue?

By : danp
Source: Stackoverflow.com
Question!

I'm using PHPMailer to send out site contacts.

In development, the script works perfectly with the GMail service over smtp. However, in production, inside the client's DMZ, it appears unable to connect to the SMTP service they have there. I have connected to the same service using telnet to port 25, so I know for sure it exists and is available to the server.

Are there any circumstances where php might not be able to open a socket connection (fsockopen)...? The php extension openssl is loaded and ok.

The error is "Unable to connect to SMTP service".

Thanks!

By : danp


Answers
If the same code works elsewhere on the same OS/webserver/PHP, then its nothing to do with the PHP code. Indeed you say:

inside the client's DMZ, it appears unable to connect to the SMTP service

This rather suggests that its a configuration issue on the production network. If you can get shell access to the srver, try telneting to port 25 on the SMTP server - I'll bet it doesn't work.

If there's a long delay in getting back this error message then it might be a DNS issue rather than a firewall/routing issue.

C.

By : symcbean


This was resolved, turned out to be an authentication issue. Hooray for finally being able to talk to the network administrators!

By : danp


Video about PHPMailer, fsockopen(), possible Apache issue?