Scheduled emails not sent

I’m having issues with sending scheduled emails. Ever since I changed in email setting from “immidiately” to “queu” emails are said to be sent in mautic but they are not. I checked all 15 of my email addresses in segment. What could be the reason fro this? Cron jobs?

These are mine:
1 * * * * su daemon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:segments:update” #mautic-segments-cron
1 * * * * su daemon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:campaigns:rebuild” #mautic-campaings-rebuild-cron
1 * * * * su daemon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:campaigns:trigger” #mautic-campaigns-trigger-cron
1 * * * * su daemon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:emails:send” #mautic-email-send-cron
1 * * * * su daemon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:webhooks:process” #mautic-webhooks-cron

Is there anyone here who can help me?

You skipped all the stuff we need to help. There is a reason that new “Support” posts ask for all this info.
What version of Mautic are you running?
What PHP?
What SQL server and version

What do the logs say. Click the gear in top right corner of your mautic install, click system info, click logs and copy/paste that .

Hi @EJL, thanks for the reply.

Mautic newest version 3.2.2
PHP Version 7.3.25
sql 8.0.22

Today’s Mautic error log is empty. Check server error log for error messages Mautic didn’t have a chance to catch.

What’s next?

open mauticdirectory/app/config/local.php and set debug to true.
look in mautic/var/log and see what those logs say.
check spool folder to see if there is anything waiting to send.
Are you running on bitnami or another similar cloud provider?
Crons testing ok? whats the output when you run them via SSH with -vvv

You should be running your cron in different minutes.

Try this settings:

# Update Mautic Segments every 15 minutes
# E.g 12:00, 12:15, 12:30, 12:45...
*/15 * * * * su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:segments:update"  >/dev/null 2>&1

# Update Mautic Campaigns every 15 minutes starting with an offset of 5 minutes
# E.g 12:05, 12:20, 12:35, 12:50
5,20,35,50 * * * * su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:campaigns:update"  >/dev/null 2>&1

# Trigger Mautic Campaigns Events every 15 minutes with an offset of 10 minutes
# E.g 12:10, 12:25, 12:40, 12:55
10,25,40,55 * * * * su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:campaigns:trigger"  > /dev/null

# Push out email queues
# E.g 12:03, 12:18, 12:33, 12: 48
3-59/15 * * * * su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:emails:send"  > /dev/null

# Clean up unused data if it is older than 60 days
# We check this every 12 hours
0 */12 * * * su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:maintenance:cleanup" --days-old=60 --no-interaction

If all of this didn’t work, you can try running directly via your console, in my case, I did this:

user@mautic:~$ sudo php7.2 /var/www/mautic/bin/console mautic:campaigns:update
Rebuilding contacts for campaign 1
0 total contact(s) to be added in batches of 300
0 total contact(s) to be removed in batches of 300

So, in your case, you might do:

su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:segments:update"

I’m running on Google cloud servers.Thats how I installed this, with just a few clicks. I’m not very familiar with commands :slight_smile:
Can you help me with that?

I edited crontabs recently:
0,15,30,45 * * * * su daemon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:segments:update” #mautic-segments-cron
5,20,35,50 * * * * su daemon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:campaigns:rebuild” #mautic-campaings-rebuild-cron
10,25,40,55 * * * * su daemon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:campaigns:trigger” #mautic-campaigns-trigger-cron
1 * * * * su daemon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:emails:send” #mautic-email-send-cron
1 * * * * su daemon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:webhooks:process” #mautic-webhooks-cron

Rebuilding contacts for segment 2
0 total contact(s) to be added in batches of 300
0 total contact(s) to be removed in batches of 300
0 contact(s) affected
Rebuilding contacts for segment 1
0 total contact(s) to be added in batches of 300
0 total contact(s) to be removed in batches of 300
0 contact(s) affected

Honestly I didn’t expect it will be this hard to set up server and fix all kinds of errors to send emails. When sending emails immidiately it works. When I switch to queue it doesn’t work. 1 h ago I sent email to 15 of my emails and I only got one so far. What happened to other 14? I need to adjust the sending speed to match the one AWS SES gave me - 1emails/sec.

How can I monitor cron job and see if its executing in the time frame I set it up for. What else can we do? Can you send me some commads and I will give you the results?

I deleted my old cron jobs and now I’m using the ones you sent me.

Just tried sending segment email to 15 addresses, mautic says its sent but they are not. I checked all 15 of them.

Yeah,I get. The advantage of the queue is that you can send larger emails.

Using systems, you can see your cron logs like so sudo journalctl -u cron

or You can log the cron job in a specified location:

*/15 * * * * su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:segments:update"  >> /var/log/mauticCron.log 2>&1

This would put all your cron logs under /var/log/mauticCron.log

Could be the cron hasn’t run, wait for few minutes. You should only use the queue methods if you are sending a large amount of emails.

What’s the large amount of emails? 1000? What if I want to send 500 emails? All of them would be sent at once and I would be probably banned by AWS since it would exceed 1 email/sec. I’m doing this for a couple of days and honestly its the most frustrating 4-5 days in my life.

Help me troubleshoot spool and other things you mentioned.

Shows you have 2 email limit for queue processing. Take that and multiply how many minutes between crons and you will see how quickly you send 15 emails.

Search the forum to see how to throttle email sends using queue and crons.

Ok, I will work on that. Does it matter that mautic says the emails are sent even though they aren’t? Right now I have created 4,5 segment emails and sent all of them. It says that all of them are sent but I only got few of them. What confuses me is exactly that: Mautic says they are sent but thats not true. Help me understand.

They appear sent as far as mautic is concerned because the messages are created in spool and will delivered via cron process.

sudo journalctl -u cron, this one works but for the bottom one I get log permission denied
This is from first command:

sudo journalctl -u cron
– Logs begin at Tue 2020-12-29 00:13:05 UTC, end at Tue 2020-12-29 00:54:01 UTC. –
Dec 29 00:13:06 debian systemd[1]: Started Regular background program processing daemon.
Dec 29 00:13:06 debian cron[324]: (CRON) INFO (pidfile fd = 3)
Dec 29 00:13:06 debian cron[324]: (CRON) INFO (Running @reboot jobs)
Dec 29 00:13:08 mautic-1-vm systemd[1]: Stopping Regular background program processing daemon…
Dec 29 00:13:08 mautic-1-vm systemd[1]: cron.service: Main process exited, code=killed, status=15/TERM
Dec 29 00:13:08 mautic-1-vm systemd[1]: cron.service: Succeeded.
Dec 29 00:13:08 mautic-1-vm systemd[1]: Stopped Regular background program processing daemon.
Dec 29 00:13:08 mautic-1-vm systemd[1]: Started Regular background program processing daemon.
Dec 29 00:13:08 mautic-1-vm cron[640]: (CRON) INFO (pidfile fd = 3)
Dec 29 00:13:08 mautic-1-vm cron[640]: (CRON) INFO (Skipping @reboot jobs – not system startup)
Dec 29 00:15:01 mautic-1-vm CRON[1678]: pam_unix(cron:session): session opened for user root by (uid=0)
Dec 29 00:15:01 mautic-1-vm CRON[1679]: (root) CMD (su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitna
Dec 29 00:15:01 mautic-1-vm su[1680]: (to daemon) root on none
Dec 29 00:15:01 mautic-1-vm su[1680]: pam_unix(su:session): session opened for user daemon by (uid=0)
Dec 29 00:15:02 mautic-1-vm su[1680]: pam_unix(su:session): session closed for user daemon
Dec 29 00:15:02 mautic-1-vm CRON[1678]: pam_unix(cron:session): session closed for user root
Dec 29 00:17:01 mautic-1-vm CRON[1718]: pam_unix(cron:session): session opened for user root by (uid=0)
Dec 29 00:17:01 mautic-1-vm CRON[1719]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Dec 29 00:17:01 mautic-1-vm CRON[1718]: pam_unix(cron:session): session closed for user root
Dec 29 00:18:01 mautic-1-vm CRON[1723]: pam_unix(cron:session): session opened for user root by (uid=0)
Dec 29 00:18:01 mautic-1-vm CRON[1724]: (root) CMD (su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitna
Dec 29 00:18:01 mautic-1-vm su[1725]: (to daemon) root on none
Dec 29 00:18:01 mautic-1-vm su[1725]: pam_unix(su:session): session opened for user daemon by (uid=0)
Dec 29 00:18:03 mautic-1-vm CRON[1723]: pam_unix(cron:session): session closed for user root
Dec 29 00:20:01 mautic-1-vm CRON[1753]: pam_unix(cron:session): session opened for user root by (uid=0)
Dec 29 00:20:01 mautic-1-vm CRON[1754]: (root) CMD (su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitna
Dec 29 00:20:01 mautic-1-vm su[1755]: (to daemon) root on none
Dec 29 00:20:01 mautic-1-vm su[1755]: pam_unix(su:session): session opened for user daemon by (uid=0)
Dec 29 00:20:01 mautic-1-vm su[1755]: pam_unix(su:session): session closed for user daemon
Dec 29 00:20:01 mautic-1-vm CRON[1753]: pam_unix(cron:session): session closed for user root
Dec 29 00:25:01 mautic-1-vm CRON[1787]: pam_unix(cron:session): session opened for user root by (uid=0)
Dec 29 00:25:01 mautic-1-vm CRON[1788]: (root) CMD (su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitna
Dec 29 00:25:01 mautic-1-vm su[1789]: (to daemon) root on none
Dec 29 00:25:01 mautic-1-vm su[1789]: pam_unix(su:session): session opened for user daemon by (uid=0)
Dec 29 00:25:02 mautic-1-vm su[1789]: pam_unix(su:session): session closed for user daemon
Dec 29 00:25:02 mautic-1-vm CRON[1787]: pam_unix(cron:session): session closed for user root
Dec 29 00:30:01 mautic-1-vm CRON[1822]: pam_unix(cron:session): session opened for user root by (uid=0)
Dec 29 00:30:01 mautic-1-vm CRON[1823]: (root) CMD (su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitna
Dec 29 00:30:01 mautic-1-vm su[1824]: (to daemon) root on none

Anyway bro, THANK YOU so much for your help, I don’t want to bother you anymore today. I will let you know tommorow what happened with those emails and if they are delivered at all. I hope everything works out otherwise I don’t have much patience nor nerves left for this. I think this is too much for me. It’s so annoying that it hurts :slight_smile: