How To Speed Up Sending of Mails

Hello,

Since Mautic 5, sending of emails is slow, so far that mails are sent in entities of 200 or so. This results in the process taking 1 hr. to send 700 emails.

This although the cronjob is scheduled

          • /bin/bash /usr/local/bin/mauticcrons.sh

This is also a problem, that emails for subscribing to an event are not sent instantly, but after several minutes, which makes it difficult for someone who wants to attend a seminar e.g. but has to wait for several minutes while the seminar already started.

Many thanks for your suggestions

Christian

Your software
My Mautic version is: 5.0.5
My PHP version is: 8.1.27
My Database type and version is: Ver 15.1 Distrib 10.11.6-MariaDB

What mailing service do you use? Using API vs SMTP usually makes a big difference, but since Version 5 in most (all?) cases needs a specific plugin for your used mail service. By standard only SMTP is enabled (it sends mails one by one, while API may send bigger batches at once).

These are the parameters you can also influence:

  • how often cron jobs run (based on the power of your server, also did you think of optimizing your cron jobs setup (How to setup Mautic cron jobs) - or do you use the basic one that comes with the setup documentation?
  • carefully increase batch sizes per cronjob run,

Make sure your cron jobs are finished, before the next starts.

Many thanks for your answer.
I’m using SMTP with Postfix.
I’musing the shell script from Joey Keller:

#!/bin/bash

MAUTICCONSOLE=“/var/www/clients/client1/web49/web/mautic/bin/console”

if [ -z “$(ls -A /var/www/clients/client1/web49/web/mautic/var/spool)” ]; then

    php $MAUTICCONSOLE mautic:broadcasts:send --limit=50
    php $MAUTICCONSOLE mautic:campaigns:rebuild --batch-limit=300
    php $MAUTICCONSOLE mautic:segment:update --batch-limit=900
    php $MAUTICCONSOLE mautic:campaigns:trigger
    php $MAUTICCONSOLE mautic:import --limit=500
    php $MAUTICCONSOLE mautic:webhooks:process
    php $MAUTICCONSOLE mautic:reports:scheduler
    php $MAUTICCONSOLE mautic:maintenance:cleanup --days-old=365

else
php $MAUTICCONSOLE mautic:broadcasts:send --limit=200
php $MAUTICCONSOLE mautic:emails:send --message-limit=200
fi

Ant the script runs every minute.

With Mautic 4 I had no issues, the mails were sent quick!

In the docs I’m seeing sometimes
/app/console mautic:segments:update
and sometimes
/app/console mautic:segment:update

without ‘s’.
What’s the difference?

It should be “mautic:segments:update”, but thats not related to sending - its about to rebuild your segments, which is important too.
(Overview of Mautic console commands - also for cronjobs - Developing your digital Business)

The script is nice and as long as the spooler is not empty it sends in junks of 200 (after the else statement).

So you send directly - without any Amazon SES; Mailjet, Sparkpost etc. and the script is the same as before? Or did you just start using this script?

Implies a max sending of 50 emails per script run (roughly every minute according to your “700” estimate)

Up the 50 to something more reasonable.

i.e.
php $MAUTICCONSOLE mautic:broadcasts:send --limit=500

Will send 500 emails per minute (and you should get to ~6500 email per hour)

Yes, I’m sending directly via my own server. Because I’m not sending millions of emails, I was choosing this option.

I was using the script already with Mautic 4.
Because the cron commands did not change with the version 5 compared to 4, I did not touch this.
I assumed that it will work as before. I just experienced while sending the first campaign with version 5. Thus my question came up.

And also, before if someone registered for the newsletter he got the confirmation mail right away. Now, it takes several minutes, although the cron job is started every minute.

Yes, this is an option, I’ll check.

Many thanks

Christian

I found something in the mautic error log:

[2024-04-14T00:01:30.647322+00:00] mautic.ERROR: [MAIL ERROR] Expected response code “250/251/252” but got code “450”, with message “450 4.1.2 abc@def.com: Recipient address rejected: Domain not found”. {“hostname”:“mars”,“pid”:387581}

In my /etc/hosts the domain mars.tld.com and mars are entered.

What changed on this matter since version 4?

It seems to work again. I reconfigured mailman3 and restarted my server. Now the mails went through.

Many thanks for all your help.