# SMTP sending only 20/minutes on two clean Mautic installations

**URL:** <https://forum.mautic.org/t/smtp-sending-only-20-minutes-on-two-clean-mautic-installations/21122>\
**Category:** Product Support\
**Created:** [October 3, 2021, 3:11pm UTC](https://forum.mautic.org/t/smtp-sending-only-20-minutes-on-two-clean-mautic-installations/21122 "2021-10-03T15:11:31Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![lior](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lior/32/931_2.png) [@lior](https://forum.mautic.org/u/lior)\
**Post date:** [October 3, 2021, 3:11pm UTC](https://forum.mautic.org/t/smtp-sending-only-20-minutes-on-two-clean-mautic-installations/21122/1 "2021-10-03T15:11:31Z")

</div>

**Your software**  
My Mautic version is: 3.3.4  
My PHP version is: 7.4.23  
My Database type and version is:MySQL 5.7

**Your problem**  
My problem is: Two mautic installation set with SMTP and to send 80/minutes (first tried 300/minute too) is only sending 20 emails/minute no matter what I do. Spool directory fills up with thousands of files to send, but only 20/minute are being sent (and deleted from the spool directory).  
SMTP tested separately and can send way more per minute (tested with 80/minute with no problem), reported limit to f the system is 5,000/hour.

Setting in Mautic currently is 80/minute. This was tested on two separate mautic installations and multiple campaign, Mautic is set to queue, cron email:send is called every minute. ( \* \* \* \* \* ).

These errors are showing in the log: no errors shown.

Steps I have tried to fix the problem: redo cron jobs, change throttling in mautic config to different values , tested SMTP to verify no problem with it to send way more per minute, monitored mautic spool directly and no matter what I do, sends emails and delete them from the spool directory in a rate of only 20/minute.

Help!

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [October 4, 2021, 5:03am UTC](https://forum.mautic.org/t/smtp-sending-only-20-minutes-on-two-clean-mautic-installations/21122/2 "2021-10-04T05:03:16Z")

</div>

Maybe your setup is not strong enough to send 80/ min?

---

<div class="post-metadata">

**Author:** ![lior](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lior/32/931_2.png) [@lior](https://forum.mautic.org/u/lior)\
**Post date:** [October 4, 2021, 5:39am UTC](https://forum.mautic.org/t/smtp-sending-only-20-minutes-on-two-clean-mautic-installations/21122/3 "2021-10-04T05:39:17Z")

</div>

Hi, that’s not the reason, there is no noticeable system load at all. I can also see that the 20 emails sent every minute are processed within less than a second every minute, then the system just waits for a minute doing nothing.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [October 4, 2021, 6:42am UTC](https://forum.mautic.org/t/smtp-sending-only-20-minutes-on-two-clean-mautic-installations/21122/4 "2021-10-04T06:42:01Z")

</div>

Did you spool all your emails prior to sent? Is the broadcast cron running at the same time as the email send cron? If so, they maybe you are spooling and sending at the same time. Not optimal.

You are saying, that email sending is set to every minute, right? Do you use any limitation for amount sent? If you have 1000 emails and set email send every minute, then after minute 2 you have 2 concurrent scripts running paralell where script 2 will fail, since it’s trying to send the same emails. After minute 3 you have 2 scripts failing, etc.

Check this Mautic Meetup:

[![](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/9/97e2e776c3a3881b387dcfc0c7809b2d55e67d45.jpeg "Mautic Cron Jobs - MMLagos October 2020") ](https://www.youtube.com/watch?v=bQ9WrgWNLVQ)

---

<div class="post-metadata">

**Author:** ![lior](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lior/32/931_2.png) [@lior](https://forum.mautic.org/u/lior)\
**Post date:** [October 4, 2021, 7:27am UTC](https://forum.mautic.org/t/smtp-sending-only-20-minutes-on-two-clean-mautic-installations/21122/5 "2021-10-04T07:27:44Z")

</div>

I see all the email files in the spool directory shortly after the scheduled campaign kicks in.  
The campaigns I tired had between 1,000-8,000 emails per campaign, so I see that amount of files in the spool directory when the campaign no starts.  
I manually monitored the spool directory, and see that every minute there’s a reduction of 20 files in the spool directory file count, and it’s instant (I never saw a graduate reduction, like 5 or 10 emails and then more) but it’s instant reduction of 20 files every minute (2150, after a minute drops to 2130 at once, then 2110 and so on until zero after a few hours). I also see get feedback from read count and other that this is the rate the emails are sent out.  
Broadcast job is every 5 minutes (does it affect send jobs?). Send job is every minute.  
I have Message limit for queue processing in mautic config set to 80. Do not send me more than is set to 120,000/day.  
I tested the smtp speed using a test program and there is no problem sending 80+/minute.  
Thanks.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [October 4, 2021, 12:02pm UTC](https://forum.mautic.org/t/smtp-sending-only-20-minutes-on-two-clean-mautic-installations/21122/6 "2021-10-04T12:02:25Z")

</div>

Back to my original question: when you run the email:send cron, do you limit how many you are sending?  
Or your script just runs every minute with a new thread after 10 minutes having 10 concurrent threads?

---

<div class="post-metadata">

**Author:** ![lior](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lior/32/931_2.png) [@lior](https://forum.mautic.org/u/lior)\
**Post date:** [October 4, 2021, 1:13pm UTC](https://forum.mautic.org/t/smtp-sending-only-20-minutes-on-two-clean-mautic-installations/21122/7 "2021-10-04T13:13:33Z")

</div>

I have “Message limit for queue processing” in mautic config set to 80. “Do not send me more than” is set to 120,000/day.  
The cron job email:send is called every minute.

Is there any other place or way to limit it?

Thanks.

---

<div class="post-metadata">

**Author:** ![lior](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lior/32/931_2.png) [@lior](https://forum.mautic.org/u/lior)\
**Post date:** [October 4, 2021, 3:23pm UTC](https://forum.mautic.org/t/smtp-sending-only-20-minutes-on-two-clean-mautic-installations/21122/8 "2021-10-04T15:23:42Z")

</div>

UPDATE - I bypassed for now by doing this:

- 
  - 
    - 
      - 
        - php7.4 /path/mautic/bin/console mautic:email:send

- 
  - 
    - 
      - 
        - sleep 10; php7.4 /path/mautic/bin/console mautic:email:send

- 
  - 
    - 
      - 
        - sleep 20; php7.4 /path/mautic/bin/console mautic:email:send

- 
  - 
    - 
      - 
        - sleep 30; php7.4 /path/mautic/bin/console mautic:email:send  
Not my favorite solution, but works (sending an email right now with it). every minute I got 20 emails sent 4 times 0, 10, 20, 30 seconds into the minute. I see the file number in the spool directory decreasing 4 times (the decrease takes no time at all, I never saw a partial of the 20 goes down). So with that, I get 80/minute (5k/hour) sent with no problem and no noticeable server load. Still wanna solve it in a more elegant way (i.e. figure out why it’s sending only 20 with each batch). Thanks.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [October 4, 2021, 6:27pm UTC](https://forum.mautic.org/t/smtp-sending-only-20-minutes-on-two-clean-mautic-installations/21122/9 "2021-10-04T18:27:24Z")

</div>

@lior

You are on a good path. However this is generating a LOT of errors. Don’t do it. How about this?

- 
  - 
    - 
      - 
        - php7.4 /path/mautic/bin/console mautic:email:send –time-limit=50 --lock\_mode=flock

- 
  - 
    - 
      - 
        - sleep 10; php7.4 /path/mautic/bin/console mautic:email:send –time-limit=40 --lock\_mode=flock  
etc…

lock mode: file lock (flock) it will help your mautic not to try to send the same emails  
time-limit will make sure your command only runs for a minute, so at every minute you have a new fresh thread

---

<div class="post-metadata">

**Author:** ![lior](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lior/32/931_2.png) [@lior](https://forum.mautic.org/u/lior)\
**Post date:** [October 4, 2021, 7:46pm UTC](https://forum.mautic.org/t/smtp-sending-only-20-minutes-on-two-clean-mautic-installations/21122/10 "2021-10-04T19:46:40Z")

</div>

I’m not sure why it will produce errors - you assume it will take more than 10 seconds for each command to process the emails?

So maybe a combo like this (just in case any takes more than 9 seconds, without flock):

- 
  - 
    - 
      - 
        - timeout 9s php7.4 /path/mautic/bin/console mautic:email:send

- 
  - 
    - 
      - 
        - sleep 10; timeout 9s php7.4 /path/mautic/bin/console mautic:email:send

- 
  - 
    - 
      - 
        - sleep 20; timeout 9s php7.4 /path/mautic/bin/console mautic:email:send

- 
  - 
    - 
      - 
        - sleep 30; timeout 9s php7.4 /path/mautic/bin/console mautic:email:send

Still want to understand why only 20 are processed…

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [October 4, 2021, 9:13pm UTC](https://forum.mautic.org/t/smtp-sending-only-20-minutes-on-two-clean-mautic-installations/21122/11 "2021-10-04T21:13:10Z")

</div>

Well check your logs. No errors like ‘try to send but email doesn’t exists’?
