Hello,
Running the following code returns FALSE.

$server = "smtp.gmail.com";
fsockopen('tcp://' . $server, 587);

I know those are correct server address and port because I have ssmtp installed on my computer it uses those values to connect. But when use those values to connect from a real web server it fails. Why is that?
Thanks in advance.

PS. I don't if ssmtp uses tcp connect. Could that be an issue?

I dont believe that you can access mail remotely via tcp.

So it would only work on the local host then?

Is there way to connect remotely?

It does depend on the server you are using. I don't know if you can access gmail or hotmail but if you have a server running it should work. At least with my provider.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.