snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.09k stars 3.18k forks source link

Unable to send mail after upgrading to Debian 12 / Snipe-It 7.0.11 - Error "Unable to connect with STARTTLS" #15457

Open angerized opened 2 months ago

angerized commented 2 months ago

Debug mode

Describe the bug

Hello,

I decided to open a new issue, sorry if this is a duplicate, but I think that it is a bit different than #14991.

Mail can not be sent after upgrading from Debian 11 and Snipe-It 6.something to Debian 12 and Snipe-It 7.0.11.

I am using an internal anonymous relay connector on our Exchange, on port 25 that worked fine until the update.

When running "php artisan snipeit:expiring-alerts" I get this error:

There are 2 assets with warranties expiring in the next 90 days.

Symfony\Component\Mailer\Exception\TransportException

Unable to connect with STARTTLS.

at vendor/symfony/mailer/Transport/Smtp/EsmtpTransport.php:153 149▕ if (!$stream->isTLS() && \defined('OPENSSL_VERSION_NUMBER') && \array_key_exists('STARTTLS', $this->capabilities)) { 150▕ $this->executeCommand("STARTTLS\r\n", [220]); 151▕ 152▕ if (!$stream->startTLS()) { ➜ 153▕ throw new TransportException('Unable to connect with STARTTLS.'); 154▕ } 155▕ 156▕ $response = $this->executeCommand(sprintf("EHLO %s\r\n", $this->getLocalDomain()), [250]); 157▕ $this->capabilities = $this->parseCapabilities($response);

  +16 vendor frames

17 app/Console/Commands/SendExpirationAlerts.php:58 Illuminate\Support\Facades\Facade::__callStatic() +12 vendor frames

30 artisan:33 Illuminate\Foundation\Console\Kernel::handle()

I tried editing the .env and add the "MAIL_TLS_VERIFY_PEER=false", but it is still the same.

I cleared my cache and so on, the issue seems to come from the connector falsely advertising STARTTLS or something, and Symfony enforcing it.

There seems to be a new parameter in Symfony 7.1 to disable auto_tls: https://symfony.com/doc/current/mailer.html#disabling-automatic-tls

Could there be an .env variable to reflect this setting?

Sending Emails with Mailer (Symfony Docs)
Installation Symfony's Mailer & Mime components form a powerful system for creating and sending emails - complete with support for multipart messages, Twig integration, CSS inlining, file attachme…

Reproduction steps

  1. Email working fine on Debian 11 / Snipe-It 6
  2. Upgrade Debian 11 to 12
  3. Upgrade Snipe-It 6 to 7.0.11 using the regular process
  4. Test email using UI -> FAILED
  5. Test email using CLI -> FAILED

Expected behavior

Email should work as before.

Screenshots

No response

Snipe-IT Version

7.0.11

Operating System

Debian 12

Web Server

Apache

PHP Version

8.2.20

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

No response

welcome[bot] commented 2 months ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.