Page 1 of 1

Problem setting up SMTP

Posted: Wed Nov 29, 2023 12:11 pm
by matlair
HESK version: 3.4.3
PHP version: 8.2.6 (MySQLi)
MySQL version: 10.5.21-MariaDB-0+deb11u1

I am having problems setting up a SMTP connection on our self-hosted HESK - everything is configured as it should (AFAIK), SMTP connection test returns a success, but no e-mails are sent. Creating a ticket generates the following debug message (server name, smtp server and IPs censored):

2023-11-29 11:57:21 SERVER -> CLIENT: 220 SMTP.ADDRESS Microsoft ESMTP MAIL Service, Version: 8.5.9600.16384 ready at Wed, 29 Nov 2023 12:57:21 +0100 <br>
2023-11-29 11:57:21 CLIENT -> SERVER: EHLO SERVER.NAME<br>
2023-11-29 11:57:21 SERVER -> CLIENT: 250-SMTP.ADDRESS Hello [XX.XX.XX.XX]250-TURN250-SIZE 30720000250-ETRN250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-8bitmime250-BINARYMIME250-CHUNKING250-VRFY250-TLS250-STARTTLS250 OK<br>
2023-11-29 11:57:21 CLIENT -> SERVER: STARTTLS<br>
2023-11-29 11:57:21 SERVER -> CLIENT: 220 2.0.0 SMTP server ready<br>
SMTP Error: Could not connect to SMTP host. Connection failed. stream_socket_enable_crypto(): SSL: Success<br>
2023-11-29 11:57:21 CLIENT -> SERVER: QUIT<br>
2023-11-29 11:57:21 SERVER -> CLIENT: <br>
2023-11-29 11:57:21 SMTP ERROR: QUIT command failed: <br>
SMTP Error: Could not connect to SMTP host. Connection failed. stream_socket_enable_crypto(): SSL: Success<br>

Our HESK is running through Apache2 on port 80, over HTTP (it is only intended for local network use). The virtual server which hosts HESK also hosts GLPI, and GLPI has no problems sending e-mails through the same SMTP server, which doesn't require any login credentials. In HESK's Email settings, Encryption is set to "None" and "Do not validate server certificates" is enabled.
Nonetheless, I suspect this is a certificate problem? Is there any way to completely disregard certification and send e-mails through SMTP, as it is working on our GLPI?

Thanks and have a great day!

Re: Problem setting up SMTP

Posted: Wed Nov 29, 2023 8:56 pm
by Klemen
If you have a local SMTP server without authentication, why don't you try setting it up for PHP mail()?

In your php.ini find and configure section under

Code: Select all

[mail function]
Then restart the server and set Hesk to "Send emails using: PHP mail()"

Any luck?

Re: Problem setting up SMTP

Posted: Thu Nov 30, 2023 5:39 am
by matlair
Hello Klemen, thank you for the quick reply.

I have tried PHP mail, and it works perfectly! I had problems with it yesterday (emails would arrive to external recipients (e.g. *@gmail.com, etc), but not ones within our M365 tenant), but it seems to be working now.

Thanks for the assist, have a great day!

Re: Problem setting up SMTP

Posted: Fri Dec 01, 2023 2:50 pm
by arib67
It seems that youur HESK SMTP setup is facing challenges with SSL/TLS. For this, you should change the Encryption setting to "None" in HESK Email preferences and confirm that "Do not validate server certificates" is activated.