Nextcloud version (eg, 20.0.5): 23.0.3
Operating system and version (eg, Ubuntu 20.04): Debian 11
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.??
PHP version (eg, 7.4): 8.0.18
The issue you are facing:
I am trying to set up smtp on my new NC 23 installation (official docker-compose file). For reasons that would take too long to explain here, my mail server does have a LE certificate but it needs to be contacted via a local IP. So for this purpose, in a previous installation (NC 22) I had to add
‘allow_self_signed’ => ‘true’,
‘verify_peer’ => ‘false’,
‘verify_peer_name’ => ‘false’,
to config.php and this worked.
With NC 23 I can’t get this to work anymore. (Not sure, if this has to do with the new version or whether it is coincidence but I can’t think of anything else that would be different…)
When I try to send the test mail, I get this error:
A problem occurred while sending the email. Please revise your settings. (Error: Unable to connect with TLS encryption)
And in the NC logs, I find:
Error: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed at /var/www/html/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php#94
So there is still a problem with verifying the mail server’s certificate (which should be mitigated by the code mentioned above.
With respect to the code: this gets eliminated from the config.php once I change the settings on the Basic Settings page - I believe this behavior is new, too. So I first set everything on the Basic Settings and then add the code in the config.php file manually and then click on “Send Email” - but it still does not work…
I am running out of ideas…
Is this the first time you’ve seen this error? (Y/N): Well, yes and no - see above.
Steps to replicate it:
- Spin up a new instance of NC23 via docker-compose
- Enter smtp credentials via web interface
- Send test email to mail server via local IP
- Get error
- Add extra settings to config.php to keep NC from verifying mail server’s certificate
- Send test mail again
- Again get error
The output of your Nextcloud log in Admin > Logging:
/path/to/nextcloud (make sure you remove any identifiable information!):
relevant part see above
The output of your Apache/nginx/system log in
Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.