Email Queue's and Sending Limits - SMTP

My Mautic version is: 4.4
My PHP version is: 8.0
My Database type and version is: MySQL 8.0

Hi, after reading the docs I realized I completely misunderstood how queue’s and frequency rules work, and now I have even more questions. lol.

I thought that these settings were for how many emails and how often they are sent, and to set limits on the number of emails I want the system to sent per day. Then I noticed that I was getting bounce issues since the emails that mautic was trying to send from the spool were too old.

So my question is, what settings and how should I sent them up if I want mautic to send a maximum of 50 emails per day (not frequency for how often someone gets an email, but a total number of outgoing emails to all recipients), and I need the emails to be fresh (meaning not collecting virtual dust in spool and then getting rejected by the recipients server).

So here is my scenario… I have a segment with about 1000 contacts in it. I have created several template emails and made a campaign with them. This campaign essentially will run indefinitely, only the contacts in the segment/campaign will change. But I need them all going through the same motion. So I want 50 contacts to get emails today, another 50 to get emails tomorrow, another 50 to get emails the day after and so on. That part seemed to be fine and dandy, I had it sending one email per 30 minutes. But thats it processing the emails in the spool folder. But what happens is it creates 1000 emails and puts them in the spool folder so that by the time it get to the last one its several days old and gets rejected when its finally sent. I hope I explained that well.

How do I get it to spool up and email, then send it, then spool up the next email, then send it, etc.

Here are my current cron jobs:

0,15,30,45 * * * * php my-path-to-mautic/bin/console mautic:segment:update
5,20,35,50 * * * * php my-path-to-mautic/bin/console mautic:campaigns:update
10,25,40,55 * * * * php my-path-to-mautic/bin/console mautic:campaigns:trigger
* * * * * php my-path-to-mautic/bin/console mautic:emails:send
* * * * * php my-path-to-mautic/bin/console mautic:broadcast:send
*/6 * * * * php my-path-to-mautic/bin/console mautic:email:fetch
*/12 * * * * php my-path-to-mautic/bin/console mautic:import
0 2 * * 0 php my-path-to-mautic/bin/console mautic:unusedip:delete
0 3 * * 0 php my-path-to-mautic/bin/console mautic:maintenance:cleanup

Hi, here is a video for Mautic4:

To sum up: if you want to send 50 emails / day, you can still create 1000 emails at once.
(Make sure you are not creating more then you can actually send until the next email is scheduled for your contact)

50 emails / day being sent only during office hours (8-17 for example) is apprx 6 emails / hour, which is 1 email / 10 min.

In other words you need to fire your cron every 10 min and make sure it only sends 1 email.

The cron would look like this:

*/10 8-17 * * * php path/bin/console mautic:emails:send --message-limit=1

1 Like

@joeyk Thanks! I already watched this video a few times, its been very helpful. Perhaps you can clarify one more thing for me. At what point are emails created and added to the spool? Is it when the campaign gets triggered? and how can I limit the amount of emails to get added to the spool at a time?

php /path/to/mautic/bin/console mautic:campaigns:trigger

Also unrelated question, what do these two cron jobs do and should I add them for when I new add contacts to the campaign?

php /path/to/mautic/bin/console mautic:campaigns:update
php /path/to/mautic/bin/console mautic:campaigns:process

Also, just remembered, with the way its messing with the statistics. Its shows that all those emails are sent, when they are actually not sent yet.

Hello!

If you send a segment email, the spool is filled by:

php /path/to/mautic/bin/console mautic:broadcast:send

This moves contacts to the campaign, and updates the next step:
php /path/to/mautic/bin/console mautic:broadcast:update

This will trigger email sending, and fill the spool with campaign emails:
php /path/to/mautic/bin/console mautic:broadcast:trigger

This is usually not used:

If you want to limit the ones above, you can limit by using --max-contacts=300, but this is not recommended, because you are not controlling which action is triggered.

Hello,

Hmmm. I see. But what if I did something like

*/10 8-17 * * * php /path/to/mautic/bin/console mautic:campaigns:trigger --batch-limit=1

Would that add 1 contact to the spool every 10 minutes starting at 8AM and ending at 5PM? If so, I think that would do what I want, am I right?

Just simply - Why?
This processes NOT 1 person / execution, but 1 person / batch during an execution.

If you want to limit then do --max-contacts=1

I have never tried this. And remember this not only referts to email sending but all campaign actions.

Ahh, well since it would affect all events in a campaign and not just emails then it will screw the other things up.

The Why - 2 reasons.

First, as I mentioned above, I was getting undelivered messages from the daemon saying that the email was rejected by the recipients server because it was too old.

Second, I’d like to address this:


It shows 1086 sent, when in reality maybe only 2 send.

Okay, that sucks. :slight_smile:
We need to fix this somehow. If you want we can take a look together in a call. Drop my a PM with your email.

Thanks for the offer, but I don’t think its necessary for me to take up your time at the moment. I’m running into some other issues with this fresh mautic install as well. So I wanna try to figure all this stuff out first myself.

No worries, good luck!