# Emails not being sent automatically (cronjob)

**URL:** <https://community.passbolt.com/t/emails-not-being-sent-automatically-cronjob/3424>\
**Category:** Installation Issues\
**Created:** [January 11, 2021, 7:23pm UTC](https://community.passbolt.com/t/emails-not-being-sent-automatically-cronjob/3424 "2021-01-11T19:23:19Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![swebervna](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.passbolt.com/swebervna/32/779_2.png) [@swebervna](https://community.passbolt.com/u/swebervna)\
**Post date:** [January 11, 2021, 7:23pm UTC](https://community.passbolt.com/t/emails-not-being-sent-automatically-cronjob/3424/1 "2021-01-11T19:23:19Z")

</div>

**Checklist**  
[X] I have read intro post: [About the Installation Issues category](https://community.passbolt.com/t/about-the-installation-issues-category/12)  
[X] I have read the tutorials, help and searched for similar issues  
[X] I provide relevant information about my server (component names and versions, etc.)  
[X] I provide a copy of my logs and healthcheck  
[X] I describe the steps I have taken to troubleshoot the problem  
[X] I describe the steps on how to reproduce the issue

**OS:** Ubuntu 18.04.5 LTS  
**Webserver:** Nginx 1.14.0  
**Php:** 7.2.24  
**Database:** MariaDB 10.1.47  
**Passbolt:** …how do I figure this out? I can’t click the help button on my top navigation bar.

**Healthcheck:**

> **[Warning Error:...](https://pastebin.com/qg0tvgFd)**
>
> Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

**Troubleshooting Steps I’ve Taken:**

1. Checked the crontab for the webserver user (www-data), and the entry is in there as:  
\*\*\* \* \* \* \* /var/www/passbolt/bin/cake EmailQueue.sender \>\> /var/log/passbolt.log\*\*

**Reproduce The Issue:**  
Execute some action that would send an email in the software, such as recovery an existing account. After I enter my email, it says it sent the email, but the email never comes. I run the cake EmailQueue.sender myself manually, and it successfully sends the email. The crontab must not be running itself.

---

<div class="post-metadata">

**Author:** ![garrett](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.passbolt.com/garrett/32/545_2.png) [@garrett](https://community.passbolt.com/u/garrett)\
**Post date:** [January 11, 2021, 7:34pm UTC](https://community.passbolt.com/t/emails-not-being-sent-automatically-cronjob/3424/2 "2021-01-11T19:34:34Z")

</div>

@swebervna Try first running the commands suggested in the Healthcheck FAIL lines near the top to clear those up.

---

<div class="post-metadata">

**Author:** ![swebervna](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.passbolt.com/swebervna/32/779_2.png) [@swebervna](https://community.passbolt.com/u/swebervna)\
**Post date:** [January 11, 2021, 8:55pm UTC](https://community.passbolt.com/t/emails-not-being-sent-automatically-cronjob/3424/3 "2021-01-11T20:55:35Z")

</div>

Those suggested commands fixed my permissions issue, but I still need help regarding the emails not sending automatically via the cronjob.

---

<div class="post-metadata">

**Author:** ![garrett](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.passbolt.com/garrett/32/545_2.png) [@garrett](https://community.passbolt.com/u/garrett)\
**Post date:** [January 11, 2021, 9:10pm UTC](https://community.passbolt.com/t/emails-not-being-sent-automatically-cronjob/3424/4 "2021-01-11T21:10:17Z")

</div>

@swebervna

I have tried a couple ways in the past, including setting crontab as the www-data user. Currently, I have my Ubuntu18.04 crontab set as the root user running a command as www-data. Maybe this would work for you:

```auto
* * * * * su -c "/var/www/passbolt/bin/cake EmailQueue.sender >> /var/log/passbolt.log" -s /bin/bash www-data

```

---

<div class="post-metadata">

**Author:** ![swebervna](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.passbolt.com/swebervna/32/779_2.png) [@swebervna](https://community.passbolt.com/u/swebervna)\
**Post date:** [February 4, 2021, 7:57pm UTC](https://community.passbolt.com/t/emails-not-being-sent-automatically-cronjob/3424/5 "2021-02-04T19:57:50Z")

</div>

@garrett  
Wow, I’ve been gone for a while haha!

Dang, that didn’t work. 😕 that work’s for you? And just to be clear, you’re adding that command to root’s crontab, right?

---

<div class="post-metadata">

**Author:** ![garrett](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.passbolt.com/garrett/32/545_2.png) [@garrett](https://community.passbolt.com/u/garrett)\
**Post date:** [February 4, 2021, 8:00pm UTC](https://community.passbolt.com/t/emails-not-being-sent-automatically-cronjob/3424/6 "2021-02-04T20:00:34Z")

</div>

@swebervna Correct, root crontab.

---

<div class="post-metadata">

**Author:** ![garrett](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.passbolt.com/garrett/32/545_2.png) [@garrett](https://community.passbolt.com/u/garrett)\
**Post date:** [February 4, 2021, 8:04pm UTC](https://community.passbolt.com/t/emails-not-being-sent-automatically-cronjob/3424/7 "2021-02-04T20:04:09Z")

</div>

@swebervna What command are you running when you do it manually and it works?

---

<div class="post-metadata">

**Author:** ![swebervna](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.passbolt.com/swebervna/32/779_2.png) [@swebervna](https://community.passbolt.com/u/swebervna)\
**Post date:** [February 4, 2021, 8:19pm UTC](https://community.passbolt.com/t/emails-not-being-sent-automatically-cronjob/3424/8 "2021-02-04T20:19:16Z")

</div>

`./bin/cake EmailQueue.sender`

I run that as root.

---

<div class="post-metadata">

**Author:** ![swebervna](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.passbolt.com/swebervna/32/779_2.png) [@swebervna](https://community.passbolt.com/u/swebervna)\
**Post date:** [February 4, 2021, 8:25pm UTC](https://community.passbolt.com/t/emails-not-being-sent-automatically-cronjob/3424/9 "2021-02-04T20:25:05Z")

</div>

@garrett

Well, it works if the command is in root’s crontab, running as root:

`* * * * * /var/www/passbolt/bin/cake EmailQueue.sender >> /var/log/passbolt.log`

Is this unadvised, though?

I checked the cake file and there’s Execute permissions:  
 ![image](https://canada1.discourse-cdn.com/flex031/uploads/passbolt/original/1X/a120d304137c4fa1ebd5d9ae48bdcdab682318bb.png)

---

<div class="post-metadata">

**Author:** ![garrett](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.passbolt.com/garrett/32/545_2.png) [@garrett](https://community.passbolt.com/u/garrett)\
**Post date:** [February 4, 2021, 8:46pm UTC](https://community.passbolt.com/t/emails-not-being-sent-automatically-cronjob/3424/10 "2021-02-04T20:46:02Z")

</div>

> **[Update passbolt server component (v2)](https://help.passbolt.com/hosting/update/install-scripts.html)**

When it comes to updates and other things, this link is my go to for recommended file permissions so nothing goes bad. At least we know why it doesn’t work now.
