Your software
My Mautic version is: 4.1
My PHP version is: 7.4
My Database type and version is:
mysql Ver 15.1 Distrib 10.3.31-MariaDB
Your problem
My problem is:
I was not receiving emails on my own email account while testing a campaign.
While mautic showed that it has sent the email, I still did not receive it.
So I checked the spool and ran grep
to find my email id in the .messages
file.
There I noticed that .message
file containing my email have its owner as root
instead of www-data
.
So I manually ran chown -R www-data:www-data /var/spool/
on my mautic root directory.
Then removed my contact from campaign and then re-added to the campaign to trigger the email.
Again searched for email in the spool and sure enough there was a .message
file there with its owner as root
. WHAT?!
And again, I didn’t receive the email on my account.
what gives?
I schedule my cron jobs in crontab -e
as ubuntu
which is a non root user.
Is this because I am running my crons as sudo
?
Here is my crontab -e
of user ubuntu
:
CRON_TZ=Asia/Kolkata
*/3 6-23 * * * sudo /home/ubuntu/mautic-crons.sh
*/3 6-23 * * * sudo php /var/www/mautic/bin/console mautic:broadcasts:send
*/3 6-23 * * * sudo php /var/www/mautic/bin/console mautic:emails:send
* * * * * sudo php /var/www/mautic/bin/console mautic:email:fetch
And here is my mautic-crons.sh
:
#!/bin/bash
sudo php /var/www/mautic/bin/console mautic:segments:update
sleep 30
sudo php /var/www/mautic/bin/console mautic:campaigns:update
sleep 30
sudo php /var/www/mautic/bin/console mautic:campaigns:trigger