Command `swiftmailer:spool:send` exited with status code 1

Mautic
4.1.0

PHP 7.4.3 :
*MySQL version 8.0.25-0ubuntu0.20.04.1

Apache Error Log
[Sun Dec 05 00:26:23.615442 2021] [fcgid:warn] [pid 3809488] [client 162.158.26.13:56518] mod_fcgid: stderr: PHP Notice: fwrite(): write of 877 bytes failed with errno=122 Disk quota exceeded in /home/training/public_html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 133, referer: Mautic

[Sun Dec 05 00:26:23.615464 2021] [fcgid:warn] [pid 3809488] [client 162.158.26.13:56518] mod_fcgid: stderr: PHP Notice: fwrite(): write of 251 bytes failed with errno=122 Disk quota exceeded in /home/training/public_html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 133, referer: Mautic

[Sun Dec 05 00:26:23.615467 2021] [fcgid:warn] [pid 3809488] [client 162.158.26.13:56518] mod_fcgid: stderr: PHP Warning: SessionHandler::write(): write wrote less bytes than requested in /home/training/public_html/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php on line 66, referer: Mautic

[Sun Dec 05 00:26:23.615470 2021] [fcgid:warn] [pid 3809488] [client 162.158.26.13:56518] mod_fcgid: stderr: PHP Notice: fwrite(): write of 8192 bytes failed with errno=122 Disk quota exceeded in /home/training/public_html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 133, referer: Mautic

[Sun Dec 05 00:26:23.615472 2021] [fcgid:warn] [pid 3809488] [client 162.158.26.13:56518] mod_fcgid: stderr: PHP Warning: session_write_close(): Failed to write session data using user defined save handler. (session.save_path: /home/training/tmp) in /home/training/public_html/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php on line 268, referer: Mautic

[Sun Dec 05 00:26:31.121177 2021] [fcgid:warn] [pid 3789490] [client 162.158.26.13:10136] mod_fcgid: stderr: PHP Warning: session_start(): Failed to decode session object. Session has been destroyed in /home/training/public_html/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php on line 156, referer: Mautic

[Sun Dec 05 02:21:37.699532 2021] [fcgid:warn] [pid 3969018] (32)Broken pipe: [client 172.70.142.187:10702] mod_fcgid: ap_pass_brigade failed in handle_request_ipc function, referer: Mautic

[Sun Dec 05 02:35:35.172439 2021] [ssl:warn] [pid 3990071] AH01906: training.sohoby.com:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)

[Sun Dec 05 02:35:35.185553 2021] [ssl:warn] [pid 3990072] AH01906: training.sohoby.com:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)

These errors are showing in the Mautic log :
[2021-12-05 00:00:51] mautic.WARNING: Command mautic:update:apply exited with status code 1
[2021-12-05 00:01:01] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: The “-y” option does not exist. (uncaught exception) at /home/training/public_html/vendor/symfony/console/Input/ArgvInput.php line 187 while running console command mautic:update:apply
[2021-12-05 00:01:01] mautic.WARNING: Command mautic:update:apply exited with status code 1
[2021-12-05 00:01:08] mautic.NOTICE: TypeError: Argument 1 passed to Swift_Transport_AbstractSmtpTransport::send() must be an instance of Swift_Mime_SimpleMessage, bool given, called in /home/training/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FileSpool.php on line 169 (uncaught exception) at /home/training/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php line 178 while running console command swiftmailer:spool:send
[2021-12-05 00:01:08] mautic.WARNING: Command swiftmailer:spool:send exited with status code 1
[2021-12-05 00:01:10] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: The “-Y” option does not exist. (uncaught exception) at /home/training/public_html/vendor/symfony/console/Input/ArgvInput.php line 187 while running console command mautic:update:apply
[2021-12-05 00:01:10] mautic.WARNING: Command mautic:update:apply exited with status code 1
[2021-12-05 00:04:38] mautic.NOTICE: Symfony\Component\Console\Exception\CommandNotFoundException: Command “cache:wamup” is not defined. Did you mean one of these? cache:clear cache:pool:clear cache:pool:delete cache:pool:list cache:pool:prune cache:warmup (uncaught exception) at /home/training/public_html/vendor/symfony/console/Application.php line 676 while running console command UNKNOWN
[2021-12-05 00:05:39] mautic.ERROR: Invalid clickthrough value: Yjo4OntmOjk6ImZiaGVkZiI7Yjo1Ont2OjM7Zjo0NzoiZGJ6Y2J2dGEuZmlmYWciO3Y6NDt2Ojk7fWY6ODoiZnpidnkiO3Y6ODtmOjc6ImZnYmciO2Y6NTU6Ijk0YjI0M2I1NDE5MmM1ODMxOTAzMjYiO2Y6NzoieWZiZSI7Zjo4OiI1MDMwNSI7ZjowOiJkdWJhYWZ5IjtiOjQ6e2Y6ODoiZnpidnkiO3Y6ODt9fQ== {“exception”:"[object] (Mautic\CoreBundle\Exception\InvalidDecodedStringException(code: 0): The string b:8:{f:9:“fbhedf”;b:5:{v:3;f:47:“dbzcbvta.fifag”;v:4;v:9;}f:8:“fzbvy”;v:8;f:7:“fgbg”;f:55:“94b243b54192c583190326”;f:7:“yfbe”;f:8:“50305”;f:0:“dubaafy”;b:4:{f:8:“fzbvy”;v:8;}} is not a serialized array at /home/training/public_html/app/bundles/CoreBundle/Helper/ClickthroughHelper.php:46)"}
[2021-12-05 00:06:33] mautic.NOTICE: TypeError: Argument 1 passed to Swift_Transport_AbstractSmtpTransport::send() must be an instance of Swift_Mime_SimpleMessage, bool given, called in /home/training/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FileSpool.php on line 169 (uncaught exception) at /home/training/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php line 178 while running console command mautic:emails:send
[2021-12-05 00:06:33] mautic.WARNING: Command mautic:emails:send exited with status code 1

Your problem
I can send emails without issues when quee is not enabled. But when I try to use quee, emails are not sent. I am using an external SMTP server (postfix) on another self hosted ubuntu machine.

This all started after a huge campaign that I sent (approx 70K emails). I thought all emails were sent, but seems like some are stuck in spool.

Also I do not know how to check the local quee/spool. I read somewhere that spooling is only done if I use the local system for sending emails. but in my case I am using an external smtp, so will 2 places will be used for spooling? (one on my location machine and the other on the external one).

On the other machine I am using virtualmin and postfix . I am able to see the messages in quee that are stuck due to blockage from other email providers. so I am clearing those messages…

Steps I have tried to fix the problem : when I try to run the following command manually:

/bin/console mautic:emails:send

I see the following:
NO OUTPUT GENERATED

and when I run the following:

bin/console swiftmailer:spool:send

it gives me:

[2021-12-05 00:49:20] Processing default mailer spool…

In AbstractSmtpTransport.php line 178:

Argument 1 passed to Swift_Transport_AbstractSmtpTransport::send() must be
an instance of Swift_Mime_SimpleMessage, bool given, called in /home/traini
ng/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FileSpool.p
hp on line 169

swiftmailer:spool:send [–message-limit MESSAGE-LIMIT] [–time-limit TIME-LIMIT] [–recover-timeout RECOVER-TIMEOUT] [–mailer MAILER] [–transport TRANSPORT] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-e|–env ENV] [–no-debug] [–]

and when I run the following:
bin/console swiftmailer:spool:send --message-limit=20 --env=prod

it gives me:

[2021-12-05 00:51:49] Processing default mailer spool…
20 emails sent

I also tried clearing and warming the cache. Didn’t help.

Thanks in advance for your time.

One more thing I want to add is that this problem started after my virtual server (on which mautic is installed) got out of space. But then I doubled the space and I still face this issue.

Why not to use mautic:email:send?

CORRECTION:
I see you started with that.
I see you have no feedback on using that command. You shouldnt. Did the emails disappear from your spool?

I’m having this issue after also running out of space and fixing the issue.

Were you able to find a solution? I have to restart my instance about every two days and it is very unpleasant.

Mautic Version

4.1.x series

PHP version

7.4.24

What browsers are you seeing the problem on?

Not relevant

What happened?

So a couple of months ago, I ran out of space on my mautic instance.

Everything seemed to be working great after upgrading my storage, however, since then, every about two days, mautic will fail and I will have to restart it,

I’ve tried many things, mainly fixing permissions with Mautic’s guide, clearing spool, clearing cache, updating, updating schema, googling log lines, but have been unable to identify the issue much less fix it, so I am here to ask for help or guidance on where the issue might be coming from.

This is what the log looks like:

mautic_prod-2022-04-11.php
[2022-04-11 00:30:34] mautic.NOTICE: PHP Notice - SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permission denied (13) - in file /var/www/html/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php - at line 106 {"maxlifetime":1440} [] [2022-04-11 00:33:18] mautic.NOTICE: PHP Notice - SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permission denied (13) - in file /var/www/html/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php - at line 106 {"maxlifetime":1440} [] [2022-04-11 01:15:33] mautic.NOTICE: PHP Notice - SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permission denied (13) - in file /var/www/html/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php - at line 106 {"maxlifetime":1440} [] [2022-04-11 02:08:11] mautic.NOTICE: PHP Notice - SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permission denied (13) - in file /var/www/html/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php - at line 106 {"maxlifetime":1440} [] [2022-04-11 02:20:22] mautic.NOTICE: PHP Notice - SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permission denied (13) - in file /var/www/html/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php - at line 106 {"maxlifetime":1440} [] [2022-04-11 04:08:48] mautic.NOTICE: PHP Notice - SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permission denied (13) - in file /var/www/html/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php - at line 106 {"maxlifetime":1440} [] [2022-04-11 11:20:19] mautic.NOTICE: PHP Notice - SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permission denied (13) - in file /var/www/html/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php - at line 106 {"maxlifetime":1440} [] [2022-04-11 11:39:14] mautic.NOTICE: PHP Notice - SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permission denied (13) - in file /var/www/html/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php - at line 106 {"maxlifetime":1440} [] [2022-04-11 13:46:43] mautic.NOTICE: PHP Notice - SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permission denied (13) - in file /var/www/html/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php - at line 106 {"maxlifetime":1440} [] [2022-04-11 14:53:24] mautic.NOTICE: PHP Notice - SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permission denied (13) - in file /var/www/html/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php - at line 106 {"maxlifetime":1440} [] [2022-04-11 16:52:32] mautic.NOTICE: Swift_TransportException: Connection to tcp://email-smtp.us-east-1.amazonaws.com:2587 Timed Out (uncaught exception) at /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php line 475 while running console command mautic:emails:send[] [] [2022-04-11 16:52:32] mautic.WARNING: Commandmautic:emails:sendexited with status code 1 [] [] [2022-04-11 21:00:04] mautic.NOTICE: PHP Notice - Undefined index: path - in file /var/www/html/app/bundles/CoreBundle/Controller/ExceptionController.php - at line 120 {"request":"[object] (Symfony\\Component\\HttpFoundation\\Request: GET 110.242.68.4:443 HTTP/1.1\r\nHost: 110.242.68.4:443\r\nProxy-Connection: Keep-Alive\r\nUser-Agent: PycURL/7.43.0 libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3\r\nX-Php-Ob-Level: 1\r\n\r\n)","exception":"[object] (Symfony\\Component\\ErrorHandler\\Exception\\FlattenException: {})","logger":"[object] (Symfony\\Bridge\\Monolog\\Logger: {})","class":"Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException","currentContent":"","layout":"Error","code":404,"anonymous":true,"baseTemplate":"MauticCoreBundle:Default:slim.html.php","templatePage":false,"template":"MauticCoreBundle:Error:404.html.php","templating":"[object] (Symfony\\Bundle\\FrameworkBundle\\Templating\\DelegatingEngine: {})","statusText":"Not Found","url":"110.242.68.4:443","urlParts":{"host":"110.242.68.4","port":443}} [] [2022-04-11 21:10:48] mautic.NOTICE: PHP Notice - SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permission denied (13) - in file /var/www/html/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php - at line 106 {"maxlifetime":1440} [] [2022-04-11 22:12:12] mautic.NOTICE: PHP Notice - SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permission denied (13) - in file /var/www/html/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php - at line 106 {"maxlifetime":1440} []

prod-2022-04-11.php
[2022-04-11 16:52:32] console.CRITICAL: Error thrown while running command "mautic:emails:send". Message: "Connection to tcp://email-smtp.us-east-1.amazonaws.com:2587 Timed Out" {"exception":"[object] (Swift_TransportException(code: 0): Connection to tcp://email-smtp.us-east-1.amazonaws.com:2587 Timed Out at /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:475, Swift_IoException(code: 0): Connection to tcp://email-smtp.us-east-1.amazonaws.com:2587 Timed Out at /var/www/html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:166)","command":"mautic:emails:send","message":"Connection to tcp://email-smtp.us-east-1.amazonaws.com:2587 Timed Out"} []

Any help appreciat it

How can we reproduce this issue?

Step 1: run out of space on mautic instance
Step 2: upgrade space

Relevant log output

No response

Code of Conduct

  • I confirm that I have read and agree to follow this project’s Code of Conduct