Mautic Community Forums

Mautic Stops sending emails when configuration is set to Queue Emails

Your software
My Mautic version is: 4.0
My PHP version is: 7.4.18
My Database type and version is: MariaDB

Your problem
My problem is: Whenever the emails are set to queue emails, the server stops sending any email. It gives the Uh Oh I think I broke message and no emails are sent.

These errors are showing in the log:
mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: “Argument 1 passed to Swift_Mailer::__construct() must implement interface Swift_Transport, bool given, called in /var/www/html/mautic/app/bundles/EmailBundle/Helper/MailHelper.php on line 308” at /var/www/html/mautic/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php line 24 {“exception”:"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Argument 1 passed to Swift_Mailer::__construct() must implement interface Swift_Transport, bool given, called in /var/www/html/mautic/app/bundles/EmailBundle/Helper/MailHelper.php on line 308 at /var/www/html/mautic/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php:24)"}

Steps I have tried to fix the problem:
I tried to change in the cronjobs, but was not successful.

Hi

A few things to check here:

  1. Check your permissions on the mautic directory and who the owner is (should all be www-data)
  2. Check your system log file inside Mautic
  3. Check your mautic.error file in /var/log/<nginx/apache2>/mautic.error
  4. Provide as much feedback here as possible (including your cronjob

1- Permissions are good and owner is www-data on all.
2- Logs show this: [2021-07-22 12:00:04] mautic.NOTICE: Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The “swiftmailer.transport.real” service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead. (uncaught exception) at /var/www/html/mautic/vendor/symfony/dependency-injection/Container.php line 275 while running console command mautic:emails:send
[2021-07-22 12:00:04] mautic.WARNING: Command mautic:emails:send exited with status code 1
3- There is no such file mautic.error in apache2.
4- I have used below cronjobs:
#Segments Every 2 Minutes
*/2 * * * * root /usr/bin/php /var/www/html/mautic/bin/console mautic:segments:update

*/3 * * * * root /usr/bin/php /var/www/html/mautic/bin/console mautic:import

#Campaigns (Every 1 Minute)

          • root /usr/bin/php /var/www/html/mautic/bin/console mautic:campaigns:update
          • root /usr/bin/php /var/www/html/mautic/bin/console mautic:campaigns:trigger
          • root /usr/bin/php /var/www/html/mautic/bin/console mautic:messages:send

#Process Email Queue Every 5 Minutes
*/5 * * * * root /usr/bin/php /var/www/html/mautic/bin/console mautic:emails:send

*/5 * * * * root /usr/bin/php /var/www/html/mautic/bin/console mautic:email:send

*/5 * * * * root /usr/bin/php /var/www/html/mautic/bin/console mautic:broadcasts:send

#Fetch and Process Monitored Email Every 10 Minutes
*/10 * * * * root /usr/bin/php /var/www/html/mautic/bin/console mautic:email:fetch

Thank you for the support.

Any help here is much appreciated.

Hi,
yes, as the log said the command, that sends the email is exiting with an error.
“The “swiftmailer.transport.real” service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.”