Connection to smtp host fails

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
Dookster
Posts: 7
Joined: Sun May 21, 2023 5:11 pm

Connection to smtp host fails

Post by Dookster »

Version of script: 3.4.3

Hello,
We moved our Hesk installation to a different hosting company today but the send mail is failing when click the Test SMTP Connection button with this error:
======================
2024-05-09 18:36:51 Connection: opening to xxxxxxx.com:587, timeout=20, options=array()
2024-05-09 18:36:53 Connection failed. Error #2: stream_socket_client(): unable to connect to xxxxxxxx.com:587 (Connection refused) [/home/xxxxxx/domains/xxxxxxxx.support/public_html/vendor/phpmailer/phpmailer/src/SMTP.php line 397]
2024-05-09 18:36:53 SMTP ERROR: Failed to connect to server: Connection refused (111)
=========================

The settings on the smtp host have NOT been changed, we use TLS for encryption.
The ONLY thing that has changed is the IP address of the new hosting account where Hesk has been moved to.
We did not change the smtp username or password.

There is NO block for the new ip address in the UFW firewall on the smtp host, but for good measure we still added an allow rule for the new ip, but this made no difference.

What is causing this??
Klemen
Site Admin
Posts: 10141
Joined: Fri Feb 11, 2005 4:04 pm

Re: Connection to smtp host fails

Post by Klemen »

A connection refused usually means indeed a port blocked in the firewall. It's the stream_socket_client() PHP function that's failing, it's not a Hesk-specific issue.

Who is the new host? Some, like GoDaddy, allow SMTP connections to only their own SMTP servers, and block access to all other (external) servers.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Dookster
Posts: 7
Joined: Sun May 21, 2023 5:11 pm

Re: Connection to smtp host fails

Post by Dookster »

Hello,

New host where Hesk is installed is a small company in Netherlands ximple.nl
I have sent tickets to both the hoster of the vps server where the smtp app is installed (our smtp host), and ALSO to the new hoster where Hesk is now hosted. The hoster where the smtp box is located claim that NOTHING is blocked on their network to cause this error and nothing has changed ever since we moved Hesk to a different hoster.

The new hoster where Hesk is installed first claimed there was nothing blocked but after making some changes in their firewall, now they see at least this message at their end as a response from the smtp box: "220 box.cdrbsoft.com ESMTP Hi, I'm a Mail-in-a-Box (Ubuntu/Postfix; see https://mailinabox.email/) "
So, this makes me think the problem is actually at the new hoster.

And when checking in Hesk we still see the same error as in my first post.
Any new suggestions??
Klemen
Site Admin
Posts: 10141
Joined: Fri Feb 11, 2005 4:04 pm

Re: Connection to smtp host fails

Post by Klemen »

If stream_socket_client(), which is a PHP function, doesn't work (can't connect), there is nothing you can do from within Hesk to fix that.

Why exactly it fails, I don't know. But this error usually indicates a port error (or a blocked IP) because the connection cannot even be established to the mail server.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply