Test emails work, emails from cron/console don't work

Your software
My Mautic version is: 5.0.4
My PHP version is: PHP Version 8.1.12-1ubuntu4.3
My Database type and version is: 8.0.35-0ubuntu0.23.04.1

Your problem

Test emails work, emails from cron/console don’t work.

I have installed the mailgun symfony mailer package, The DSN seems to work inside Mautic’s settings menu with sending a test email (and from a test email in the mail channel)

When running the cron command directly (php console mautic:broadcasts:send), it sees the email and attempts to send a batch. But all 100 fail.

In the Mautic log, I can see the following error.

[2024-05-06T12:41:33.318697+00:00] mautic.ERROR: [MAIL ERROR] Unknown DSN scheme. Please make sure the mailer DSN is configured properly. {“hostname”:“redacted”,“pid”:38469}

Nothing shows in the apache/php error log.

This doesn’t seem to make sense to me as the DSN works inside Mautic’s interface and emails show up in mailgun and the respective mailboxes.

Any insights as to why this would happen?

Solution:

Delete Mautic 5, install Mautic 4 and modify the release_metadata.json file to allow PHP 8.1

Muatic 5 isn’t ready.

Are you sure your crons were set up properly?

They were triggering, and I also ran php console mautic:broadcasts:send directly from SSH. The console output shows the email that is being sent, and shows 100 failed emails. And it also shows the DSN error in the log too.

It seems as if despite installing the Symfony mailer for mailgun, which lets the test email work from the UI. The console script can’t see that it has been installed, hence the “Unknown DSN scheme” error.