How to configure mautic 6.0.5 to use doctrine queues

Your software
My Mautic version is: 6.0.5
My PHP version is: 8.3
My Database type and version is: MariaDB 11.8.3

Current Status
I am currently using the “sync” scheme for sending e-mails directly to my SMTP service as soon as they are generated by the campaigns, and it works just fine.

Objective
I would like to go towards a more professional configuration so that mautic stores messages in doctrine queues and then sends them out at a slower pace using the “messenger:consume email“ cron tasks

Your problem
I tried to follow an older guide on this forum showing how to set up doctrine queues in mautic v5, but it seems I am still missing something out.
This is what I did:

  1. In mautic UI “Queue Settings”, in the “Queue for e-mail” section, I changed scheme to “doctrine”, and SMTP server hostname to “default”, so that the DSN line below reads “doctrine://default”
  2. I configured two cron jobs for, if I well understand, sending campaign/segment e-mails to the queue:
    * 8-18 1-5 sleep 0 && php bin/console mautic:messages:send -n >> /var/log/mautic/mautic-messages-send.log 2>> /var/log/mautic/mautic-messages-send-error.log
    *
    8-18 * * 1-5 sleep 0 && php bin/console mautic:broadcasts:send -n >> /var/log/mautic/mautic-broadcasts-send.log 2>> /var/log/mautic/mautic-broadcasts-send-error.log
  3. I configured an additional job to fetch messages from the queue and send them to the SMTP transport:
    * 8-18 * * 1-5 sleep 0 && php bin/console messenger:consume email -n --limit=10 --time-limit=30 --memory-limit=128M >> /var/log/mautic/mautic-messenger-consume-email.log 2>> /var/log/mautic/mautic-messenger-consume-email-error.log

But when I try to send a test message from the UI (Queue Settings), it won’t be delivered: it seems it is getting lost somewhere, and I don’t even know if the message ended up in the doctrine queue (should maybe check in the database table?).
By looking at the logs for the cron tasks above I get:

  • $ cat /var/log/mautic/mautic-messages-send.log | tail -n 10
    [2026-02-05 15:13:01] Processing message queue
    [2026-02-05 15:13:01] Messages sent: 0

  • $ cat /var/log/mautic/mautic-broadcasts-send.log | tail -n 10
    [2026-02-05 15:15:02] ±--------±-------±---------+
    [2026-02-05 15:15:02] | Channel | # sent | # failed |
    [2026-02-05 15:15:02] ±--------±-------±---------+

  • $ cat /var/log/mautic/mautic-messenger-consume-email.log | tail -n 30

  • $ cat /var/log/mautic/mautic-messenger-consume-email-error.log | tail -n 30
    [OK] Consuming messages from transport “email”.
    // The worker will automatically exit once it has processed 10 messages,
    // exceeded 128M of memory, been running for 30s or received a stop signal via
    // the messenger:stop-workers command.

    // Quit the worker with CONTROL-C.

    // Re-run the command with a -vv option to see logs about consumed messages.

So no error there, except that, to my surprise, the output “messanger-consume” job was logged in the error log instead of the standard one. It seems the process is terminating with a non-zero status code, maybe because the timeout elapsed without anything to send.

So my question is: what am I missing here?
Any idea?

I reply to my own topic here for a quick update.

The test message from mautic’s UI is still not being delivered, but I tried to launch a test campaign and those messages are being delivered! Manually sending an e-mail to a contact works too!

But I don’t know yet for sure whether the messages went through the doctrine queue or not.
It is hard to tell, since I can’t find any trace of the messages in the logs for any of the involved cron jobs:

  • mautic:messages:send
  • mautic:broadcasts:send
  • messenger:consume email

Next I’ll be looking in the queue’s table on the database.
Any idea or suggestion is welcome!

One more (last?) update on this on my side.

I launched another test campaign and have been monitoring the “messenger_messages” queue on the database by issuing the command:

sudo -u www-data php bin/console doctrine:query:sql “SELECT COUNT(*) FROM messenger_messages”

and I verified that messages are indeed landing there for some time until the “messenger:consume email” cron job consumes them and sends them out to the SMTP transport!

So I guess that’s all folks!

No, the previous one was not the last update on this topic :face_exhaling:

I thought I had managed to configure doctrine queues correctly, and my test campaign on a test segment with just one contact worked fine yesterday, but with mautic, nice little (but beautifully undocumented) piece of software, you can never call it a day!

I was waiting for a real campaign (~1000 contacts) to kick-in this morning and yes, it started as expected, loaded all contacts, scheduled sending e-mails and… stop! Nothing is going out to the SMTP transport.
No error in the logs for the involved cron jobs:

  • mautic:messages:send

    [2026-02-04 10:43:02] Processing message queue
    [2026-02-04 10:43:02] Messages sent: 0

    all the time

  • mautic:broadcasts:send

    [2026-02-05 11:18:01] ±--------±-------±---------+
    [2026-02-05 11:18:01] | Channel | # sent | # failed |
    [2026-02-05 11:18:01] ±--------±-------±---------+

    all the time

  • messenger:consume email

    [OK] Consuming messages from transport “email”.

    // The worker will automatically exit once it has processed 10 messages,
    // exceeded 128M of memory, been running for 30s or received a stop signal via
    // the messenger:stop-workers command.

    // Quit the worker with CONTROL-C.

    // Re-run the command with a -vv option to see logs about consumed messages.

And, as expected from the logs above, no message is being stored in the “messenger_messages” table on the database:

$ sudo -u www-data php bin/console doctrine:query:sql “SELECT COUNT() FROM messenger_messages”
——————
Count (
)
—————–
0
—————–

So of course, no message landing in the queue, no message being sent out!

I tried to run my test campaign again, and it still works, so I wonder what is preventing my production campaign to move forward. What is preventing scheduled messages to land in the doctrine queue?

Is there a limit on the number of messages to be scheduled in a campaign somewhere?
Are 1000 messages too many to be stored in the doctrine queue (I don´t think so)?
Any suggestion?

One more update on my mautic saga since I know that people are getting passionate about this :wink: !

Since the “big” campaign I had scheduled for last Friday (~1000 contacts/messages) did not appear to make any progress I canceled it and decided to split it into three smaller campaigns (140, 530, 330 messages) starting at staggered times (at 9, 10, 11AM) and see what happens.

First of all, for all three campaigns I could verify that messages have indeed been placed in the doctrine queue at a pretty fast pace and then slowly consumed, although they have been following a quite unexpected pattern:

The first campaign started as scheduled and successfully run to completion before the next one kicked-in. I had expected that, by sending 140 messages, I would find at most 140 records in the “messenger_messages” table on the database, but actually the records grew to about double that figure (~300 records at peak).

The second campaign also started on time, but I noticed it grew even larger than the first one: I got ~3.5k records out of 530 messages. Given this large number of mysterious records (duplicates?) that mautic generated, it was not yet finished when the next one kicked in..

The third campaign initially seemed to be stuck, but since there where still records from the previous campaign in the queue, I decided to let it go and see what happens.
And indeed I saw that it finally started placing new messages in the queue at about 2PM (instead of 11AM as scheduled), and the “messenger:consume email” cron task finished processing all records al about 4.30PM).

But even though mautic placed way more records in the doctrine queue than I had expected, I verified that only ~1000 e-mail messages have been sent out to the SMTP transport (and delivered), matching the number of contacts in the target segments.

Lesson learned: you just need to be patient, and the campaign will eventually run and send all messages, even though not on schedule.

Open questions:

  1. Why is mautic generating way more records in the queue than there are messages to send?
  2. Can this behaviour be due to a lack of processing power on my instance, given that I’m using a small VPS to run mautic?

Any idea?

P.S: Next, I will try to increase the number of messages processed at once by the “messanger:consume email“ task (–limit parameter) from 10 to 20 and see if I can keep the doctrine queue under control.