# Amazon SES: Number of sent emails differs

**URL:** <https://forum.mautic.org/t/amazon-ses-number-of-sent-emails-differs/35205>\
**Category:** Product Support\
**Created:** [March 7, 2025, 11:25am UTC](https://forum.mautic.org/t/amazon-ses-number-of-sent-emails-differs/35205 "2025-03-07T11:25:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![taxi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/taxi/32/522_2.png) [@taxi](https://forum.mautic.org/u/taxi)\
**Post date:** [March 7, 2025, 11:25am UTC](https://forum.mautic.org/t/amazon-ses-number-of-sent-emails-differs/35205/1 "2025-03-07T11:25:22Z")

</div>

**Your software**  
My Mautic version is: 5.2.3  
My PHP version is: 8.2.26  
My Database type and version is:

**Your problem**  
My problem is: Count of emails in Amazon SES is 160, Mautic says 1100. How do I find out if all emails are sent

These errors are showing in the log:

Steps I have tried to fix the problem:

---

<div class="post-metadata">

**Author:** ![taxi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/taxi/32/522_2.png) [@taxi](https://forum.mautic.org/u/taxi)\
**Post date:** [March 23, 2025, 8:53am UTC](https://forum.mautic.org/t/amazon-ses-number-of-sent-emails-differs/35205/2 "2025-03-23T08:53:41Z")

</div>

I gave it another try. This time, AWS shows 410 messages sent. Mautic shows, 1282 sent.  
My AWS account limit is 100k and 50/s.

I have no clue if the difference between the two numbers was sent or not.

I’m using the mautic-consumer.service from @joeyk for sending the emails out of the DB queue.

My mauticcron.sh looks like this:  
#!/bin/bash

MAUTICCONSOLE=“/var/www/mautic/bin/console”

```
    php $MAUTICCONSOLE mautic:campaigns:rebuild --batch-limit=300
    php $MAUTICCONSOLE mautic:segment:update --batch-limit=900
    php $MAUTICCONSOLE mautic:campaigns:trigger --campaign-limit=50
    php $MAUTICCONSOLE mautic:import --limit=5000
    php $MAUTICCONSOLE mautic:webhooks:process
    php $MAUTICCONSOLE mautic:reports:scheduler
    php $MAUTICCONSOLE mautic:broadcast:send --batch=5 --limit=500

```

Any hint how I can improve on this?

Do I need the -batch option?

Many thanks

Christian

---

<div class="post-metadata">

**Author:** ![dirk\_s](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/dirk_s/32/748_2.png) [@dirk\_s](https://forum.mautic.org/u/dirk_s)\
**Post date:** [March 25, 2025, 9:59pm UTC](https://forum.mautic.org/t/amazon-ses-number-of-sent-emails-differs/35205/3 "2025-03-25T21:59:19Z")

</div>

You may also test with:

[GitHub - twentyZen/mautic-cronjobs: This script and environment file helps to manage cron jobs for Mautic.](https://github.com/twentyZen/mautic-cronjobs) (but adjust your parameters in the .env for your environment).

Otherwise you may test with smtp. If numbers are correct then, it will be related to batched sending. You may have hit a limit?

(Do you use virtual mail delivery manager? It may have delayed sending?)

---

<div class="post-metadata">

**Author:** ![taxi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/taxi/32/522_2.png) [@taxi](https://forum.mautic.org/u/taxi)\
**Post date:** [March 27, 2025, 6:36am UTC](https://forum.mautic.org/t/amazon-ses-number-of-sent-emails-differs/35205/4 "2025-03-27T06:36:00Z")

</div>

Many thanks Dirk,

I will test some more.

Is the twentyZen working out of the box with a consumer-service daemon for the consuming command, or do I have to adapt something like the last line in the script:  
COMMAND\_QUEUE=“messenger:consume email --limit=$EMAILS\_PER\_BATCH --time-limit=$QUEUE\_TIME\_LIMIT|true”

Having a sending rate of 50 emails per second, It should be okay to change  
EMAILS\_PER\_BATCH=14 to 50

and ignore the following values:

# Email settings (Batch size needs to be adjusted to your mail service, if you send without queue)

BROADCASTS\_BATCH\_LIMIT=50  
BROADCASTS\_SEND\_LIMIT=560

# Command limits

SEGMENTS\_UPDATE\_LIMIT=900  
CAMPAIGNS\_REBUILD\_LIMIT=300  
IMPORT\_LIMIT=500

and it should work, correct?

Mana thanks

Christian

---

<div class="post-metadata">

**Author:** ![dirk\_s](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/dirk_s/32/748_2.png) [@dirk\_s](https://forum.mautic.org/u/dirk_s)\
**Post date:** [March 27, 2025, 10:07am UTC](https://forum.mautic.org/t/amazon-ses-number-of-sent-emails-differs/35205/5 "2025-03-27T10:07:21Z")

</div>

The whole concept is based on cron jobs triggering the script. It reads the .env file and loops through all activated commands. E-Mail handling is a special loop, as it loops as long as there are mails in the queue up to the max.

You may look into timing. I loop through it by batches and adds the defined delay. Actually in the example it adds 1 sec in each loop to make sure its really not sending more than batch size in a second. This might be inefficient, if sending 50 mails already takes more than a second with this looping script. Delay could then be 0.

Thats why it always may need some adjustment.

Next level could really be to adjust it to a running daemon that sends continuously. I just don’t know the implications and how to control the speed of sending of the daemon.

---

<div class="post-metadata">

**Author:** ![taxi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/taxi/32/522_2.png) [@taxi](https://forum.mautic.org/u/taxi)\
**Post date:** [March 27, 2025, 11:52am UTC](https://forum.mautic.org/t/amazon-ses-number-of-sent-emails-differs/35205/6 "2025-03-27T11:52:00Z")

</div>

Thanks Dirk,

I set up the daemon, according to @joeyk, documentation here:

> **[Email sending in Mautic 5: Cron, Queue and Daemons – Joey Keller](https://joeykeller.com/email-sending-in-mautic-5-cron-queue-and-daemons/)**

I’ll figure it out somehow.

Kind regards

Christian

---

<div class="post-metadata">

**Author:** ![dirk\_s](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/dirk_s/32/748_2.png) [@dirk\_s](https://forum.mautic.org/u/dirk_s)\
**Post date:** [March 27, 2025, 12:18pm UTC](https://forum.mautic.org/t/amazon-ses-number-of-sent-emails-differs/35205/7 "2025-03-27T12:18:23Z")

</div>

If you have changes that will support the daemon, please let me know.
