2

In my .env file I have:

MAILER_URL="smtp://localhost:25?encryption=&auth_mode="

But if I send a mail the log shows:

Could not send mail: Failed sending mail to following recipients: {{ recipients }} with Error: Unable to connect with STARTTLS. Error Code:0 Template data ...

Looks like it tries to use TLS but I don't want to. It worked before. Maybe it got broken by an update.

Looking at the documentation I also tried encryption=null with same result.

Debugging in vendor/shopware/core/Content/Mail/Service/MailerTransportFactory.php:36 I made sure my MAILER_URL was used.

I am using shopware 6.4.1.1 with symfony/mailer v5.2.10

How can I get mails working again?

PiTheNumber
  • 22,828
  • 17
  • 107
  • 180

1 Answers1

4

By default, the SMTP transport in the Symfony Mailer performs TLS peer verification. You can disable this verification by setting the parameter verify_peer to 0, for example:

MAILER_URL="smtp://localhost:25?encryption=&auth_mode=&verify_peer=0"
Paweł Napierała
  • 1,631
  • 10
  • 15
  • 3
    I got some additional information: Symfony Mailer removed the parameters `encryption` and `auth_mode`. If you like to use TLS you should use `smtps://`. Also if the server supports TLS it automatically uses it, even if you did not select `smtps://`. I my case the certificate was self signed, that is why the `verify_peer=0` is needed. All in all this will do the same: `MAILER_URL="smtp://localhost:25?verify_peer=0"` – PiTheNumber Jul 06 '21 at 13:31
  • 1
    See also: https://github.com/symfony/symfony/issues/41997 – PiTheNumber Jul 06 '21 at 14:18