I absolutely need a throttling feature between emails

Latest version of Mautic, latest PHP

I need to throttle between individual email sends, I know there are cron for batches, but it needs to be delays between individual messages like this:

email 1
11:00:07

email 2
11:00:45

email 3
11:01:18

And messages have to be sent at random intervals between X and Y, for example between 30 and 120 seconds.

I have been waiting 2 years for this, Lemslist and Gmass alread have that feature.

This is a deal breaker and why I’m not moving to Mautic (and thousands of other users also)

Is this even possible, ever?

Screen cap of what I mean is over here:

1 Like

What is the point of this?
Is the point is that you want to look like a person is sending mass email, not a software?
Thx,
J

Hi Joey,

thanks for reply on a Sunday!

yes, basically make it look more like it’s send by a person

The point is that if you send too fast, Google thinks you are sending spam, and they lock you out of your account, in my experience, you can only send small batches.

So you need to set up tons of small batches.

With random sequential sending, you can space out your sends, and ISP’s don’t ban you for sending too fast

So say you want to send 100 emails, you have them spaced out to send within say 3 hours or so, easy on the servers, no red flags

Hi,

(After reading my comment I realised, it’s pretty judgemental. I apologise in advance.)

I know, that Gmass is used by “cold outreach professionals” (wink) a lot for exactly because of the ability of sending slow.

However if you work with double opt in lists, this is not needed at all.

Once a person has clicked on any of your emails (not unsub) than the established relationship will ‘overwrite’ the possible flag from ‘too fast sending’. So you and thousends of others actually don’t need this feature if your list is double opt-in.

I’m sending with 14-40 emails / sec and have no problems delivering 30%+ on 10k+ batches into gmail every day.

I’m not in charge here, but I strongly feel, that this feature would attract the wrong crowd, and mess up Mautic’s good reputation. What I mean by that is: when you try to inbox, you get different score from Barracuda and other spam filters. The software used for sending is one of the attributes being scored. I have seen spam reports where Sendy and Gmass were flagged just for being used as sending agent. I hope Mautic won’t get into this box.

BTW Gmass is like $9-$13 / month, no? Why don’t you use it? If you send 500 / day, 15.000 / month emails, and you don’t make your $13 back, than you are sending the wrong emails to the wrong people.

Regarding your problem:
If you want to achieve what you are saying, it’s pretty simple:

  1. https://stackoverflow.com/questions/2556190/random-number-from-a-range-in-a-bash-script
  2. php /path/to/mautic/bin/console mautic:broadcasts:send [–id=ID]

Connect the dots.

Good luck.
Joey

1 Like

Hi Joey,

Actually I need this to book work, I’m a Drupal guy (Aquia bought mautic!) and I look for Drupal 7 sites and email companies to offer migration services to Drupal8 or 9. Gmass is buggy and it doesn’t have CRM , so mautic is best.

So it’s the furthest thing from spam, that’s just the best way to get in touch!

I looked at that post on stackoverflow, but I have no clue how to get it done!

It doesn’t look “pretty simple” to me!

Any tutorial on how to do this, or even where to start?

I can get on the serve with SSH, but that’s about it!

Hi,
This is what you should do:
Create an shell script, that

  • generates a random number between 10-30 (or your interval)
  • runs a mautic command, that waits your interval and sends out 1 (or your choice of batch) email for the campaign you designate in your command.

Than you set up a cron for this command to run. I use a similar script for warming up IPs.

Good Luck
Joey

1 Like

I get your frustration, and luckily this is kinda easy to setup. I guess you already know that mautic can send emails in two ways; send immediately and by queuing.

To throttle the sending time, you first need to go to the config panel -> Email Setting, and set “How should email be handled?” to Queue (I guess you already did that)

Here is where things get interesting, under the Email Setting section, you’ll see “Message limit for queue processing

The “message limit for queue processing” set the number of emails that should be processed every time an instance call to send the emails triggers, e.g your cron job, another way of saying this is that the “message limit for queue processing” is how many emails that are “Pending” will be processed the next time the cron job designated for sending emails is triggered.

If 100 email is pending, how many do you want to send when the cron job for sending an email is triggered, it is as simple as that.

So, if you set the “mautic:emails:send” cron job to trigger every 15 minutes, and you set the “message limit for queue processing” to 10, this means that you are throttling the mail sending to only send 10 emails every 15minutes. 60 (1 hour) divided by 15 is 4, so, you can send 40 emails/hour.

The point here is knowing the frequency at which the cron job triggers. If you for example set the “mautic:emails:send” cron job to trigger every minute, and you set the “message limit for queue processing” to 40, this gives us 40 x 60 = 2400/emails/hour

Here is a way to throttle email in small batch, I’ll assume you want to send 60 emails per hour, so this is what I’ll do, I’ll change the frequency of the cron job to 5 minutes, that is the minutes the cron job triggers. Now, divide the number of emails you want to send per hour by the amount of time the cron job will trigger per hour, 60/12 = 5

Navigate on to the Email Settings, and change the “message limit for queue processing” to 5, and this way you can send 60 emails per hour.

Feel free to adjust the number as you see fit, just make note of the time the cron job triggers.

Good Luck!

2 Likes

Wow, thanks a million, will try this today :wink:

that could work, do the emails get sent in one shot or spaced out?

For example, if I set it to 60 emails an hour, does it?

A. Send 60 emails in 1 minute, then the rest of the 59 minutes nothing
B. Does it send 60 emails, one every minute
C. Does it send the emails randomly with the first one at first minute, and last one at 60th minute

What do your sent items look like?

The above mentioned solution is really good if you want to send 1 email / minute (not randomly).
Any email you send will be sent with this speed.

1 Like

If you set it to 60 emails per hour, it sends 1 email every minute, and no, it doesn’t send it randomly, I think 60 emails per hour isn’t too bad for throttling. If you want to space it out, like a delay between email, then that is a different story, and it shouldn’t be that difficult to do:

Note: I haven’t tested this, just writing this at the top of my head, so, you might want to run a test to see if it works, but, I am certain, it would work, there are multiple ways to do this, so, I’ll give you the best method I can think off:

Replace The Specific Cron Job With Systemd
Systemd is well more robust than cron, I won’t get into why, as that is not the question, to set a systemd, we would use the following features:

Services: This is the place you run the mautic email send command
Timers: You can set when to run the service, you can run the command every 10 seconds, or every 30 seconds, and even add random delays, cool right :wink:

Let’s get into the creation, create a service as follows:

sudo nano /etc/systemd/system/mautic-throttle.service

Inside the file add the following:

[Unit]
Description=Throttle mautic emails
Wants=mautic-throttle.timer
[Service]
ExecStart=/usr/bin/php /var/www/mautic/bin/console mautic:emails:send > /dev/null
WantedBy=multi-user.target

Now, let’s set the timer, create and open the following as follows:

sudo nano /etc/systemd/system/mautic-throttle.timer

To run the email every 50 seconds + some random duration below 50 seconds, you add the following:

[Unit]
Description=Run mautic-throttle.service every 50 seconds
Requires=mautic-throttle.service
[Timer]
Unit=mautic-throttle.service
OnUnitInactiveSec=50
RandomizedDelaySec=50
AccuracySec=1s
Persistent=True
[Install]
WantedBy=timers.target

If for example, you want to send email every 5 minutes and you want to randomized the sending below 2 minutes, you change the OnUnitInactivesec and RandomizedDelaySec to:

OnUnitInactiveSec=5m
RandomizedDelaySec=2m

To finalize it, you install the services using:

sudo systemctl daemon-reload

sudo systemctl enable mautic-throttle.timer

sudo systemctl start mautic-throttle

If something went wrong when setting up a service, you can find it out by running

systemctl status mautic-throttle

Optional
systemctl list-timers # view the status of the timers
journalctl -u mautic-throttle # view the logs of the mautic-throttle

This is a robust method, and you can control a lot more rather than relying on cron job, if you know bash scripting, then you can automate all this process easily.

I wrote all this on my smartphone, so, there might be some mistakes, let me know how it goes.

3 Likes

All right, I will attempt this!

I’m on shared hosting, they say I can’t use nano…

I suppose I could do this with file manager, just paste the text in?

Where is this directory?

/etc/systemd/system/

How can I run these without nano?

sudo systemctl daemon-reload

sudo systemctl enable mautic-throttle.timer

sudo systemctl start mautic-throttle

If something went wrong when setting up a service, you can find it out by running

systemctl status mautic-throttle

I have SSh access to server, not sure I can use sudo either , this is greengeeks shared hosting

These are all server level commands, so, if you have ssh access to the server, then that’s where you carry out the operation. If you are not comfortable running commands, please hire someone to do this for you, this way, you won’t mess up your mautic instance all together.

1 Like

I can do some of it, I mean I run SSH and git for Drupal8 and Google cloud, with Putty etc…

But GreenGeeks say I need a VPS to do this…

Can I run this on Xampp, maybe run it off virtual box on a linux install, would that work?

if not, what cheap or free hosting would allow me to do what you are teaching me?

Yh, you can use virtual box. I use it often.

But, I most times use upcloud if I need something really quick, I’ll recommend upcloud. You can use the free trial to run a test.

1 Like

This would make a great article for the Knowledgebase - would you be up for contributing something?

No P. I think I have a bit of time, so, how do we get started?

Swiftmailer has a plugin for that https://swiftmailer.symfony.com/docs/plugins.html#antiflood-plugin

1 Like

I read that post and they mention this code:

// Create the Mailer using any Transport
$mailer = new Swift_Mailer(
 new Swift_SmtpTransport('smtp.example.org', 25)
);

// To use the ArrayLogger
$logger = new Swift_Plugins_Loggers_ArrayLogger();
$mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($logger));

// Or to use the Echo Logger
$logger = new Swift_Plugins_Loggers_EchoLogger();
$mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($logger));

// Continue sending as normal
for ($lotsOfRecipients as $recipient) {
 ...

 $mailer->send( ... );
}

// Dump the log contents
// NOTE: The EchoLogger dumps in realtime so dump() does nothing for it
echo $logger->dump();

But in what file and where do I paste this so it works?

Thank you so much bro. But I am having an issue. Does this throttling system only work for broadcast emails? In email settings, I set it to queued and set the number to 1 but in my email campaign, it sends all pending emails every time the corn job triggers.