# Mautic not sending emails: Some .message files in spool have their owner as root

**URL:** <https://forum.mautic.org/t/mautic-not-sending-emails-some-message-files-in-spool-have-their-owner-as-root/21908>\
**Category:** Product Support\
**Created:** [December 5, 2021, 11:21am UTC](https://forum.mautic.org/t/mautic-not-sending-emails-some-message-files-in-spool-have-their-owner-as-root/21908 "2021-12-05T11:21:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shailemalla](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/shailemalla/32/1394_2.png) [@shailemalla](https://forum.mautic.org/u/shailemalla)\
**Post date:** [December 5, 2021, 11:21am UTC](https://forum.mautic.org/t/mautic-not-sending-emails-some-message-files-in-spool-have-their-owner-as-root/21908/1 "2021-12-05T11:21:59Z")

</div>

**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`:

```auto
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`:

```auto
#!/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

```

---

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [December 5, 2021, 1:54pm UTC](https://forum.mautic.org/t/mautic-not-sending-emails-some-message-files-in-spool-have-their-owner-as-root/21908/2 "2021-12-05T13:54:13Z")

</div>

I would run the cross as www-data user. This will sort out many of the permission problems
