Admin Email Notifications

I am trying to get email notifications sent to the Admin group for my Nextcloud server.

I have test emails working. I am using Postfix.

I understand users can get personal emails set up like so by configuring which notifications they want to receive on their Personal pages.

But what about admins?

I have a cron job set up to run every 15 minuets as stated in the Nextcloud documentation. I do not receive emails however.

My understanding is that Nextcloud administrators are getting the results of the cronjob emailed to them.

How is this done?

Please and thank you! :slight_smile:

P.S. I am using Red Hat Enterprise Linux Server VERSION=“7.3 (Maipo)”. Nextcloud v11.

Could be missing MX record for your domain in your DNS.

Sanook - as mentioned I am successfully getting test emails. Postfix works. I am not even seeing mail being sent in my maillog. (I would see failed email if it was being sent).

I have added MAILTO=myemail@address.com to the top of the crontab file. Still nothing.

Any ideas?

Did you threw an eye at the admin settings?

So with the help of timsen in the IRC chat, I solved the issue. Sorry Sanook, you were not understanding the issue.

I created a cronjob using crontab -u apache -e

[root@NEXTCLOUD nextcloud]# crontab -u apache -l
MAILTO=email@address.com

*/15  *  *  *  * php -f /var/www/html/nextcloud/cron.php
0  */6  *  *  * /var/www/html/nextcloud/./script.sh

As you can see every 6 hours it executes script.sh

This script is composed of:

#/bin/bash
NOW=$(date +"%Y-%m-%d-%H-%M");
LOGFILE="log-$NOW.log";
{ sudo -u apache /usr/bin/php /var/www/html/nextcloud/occ user:list; sudo -u apache /usr/bin/php /var/www/html/nextcloud/occ user:report; sudo -u apache /usr/bin/php /var/www/html/nextcloud/occ files:scan --all; }>/var/www/html/nextcloud/nclogs/$LOGFILE; sed '/Scanning/,/+/d' /var/www/html/nextcloud/nclogs/$LOGFILE;

The output looks like the stuff below. As you can see the part with “Scanning…” is removed with sed.

  - user1: user1
  - user2: user2
  - user3: user3
+------------------+----+
| User Report      |    |
+------------------+----+
| Database         | 3 |
|                  |    |
| total users      | 3 |
|                  |    |
| user directories | 3 |
+------------------+----+

| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 100     | 300   | 00:00:00     |
+---------+-------+--------------+