Nextcloud sending emails every 15 min

Support intro

Nextcloud send email every 15 minutes

After about 3 month not maintaining nextcloud, I recognized that nextcloud is not sending emails. I did aupdate to latest version and increased PHP version. Still no email notifications received. nextcloud gui indicates cron job was not running since 3 month. I added under /usr/local/etc/php/ext-20-apcu.ini the followingapc.enable_cli=1
With this fix, nextcloud is now sending the emails and GUI indicates no more issues with cron. But it is going to far, its now sending emails every 15 minutes.

Nextcloud version (eg, 20.0.5): 25.0.3
Operating system and version : FreeBSD 13.1-RELEASE-p2 amd64
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.54 (FreeBSD)
PHP version (eg, 7.4): Version: 8.1.12

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N): Y

The output of your Nextcloud log in Admin > Logging:

{"reqId":"S9kvX7gsAItaOdhjy8m9","level":0,"time":"2023-01-28T10:47:48+00:00","remoteAddr":"lanadress118","user":"administartor","app":"no app in context","method":"GET","url":"/.well-known/nodeinfo","message":"2 well known handlers registered","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":[]}
{"reqId":"HhE79Tc5H7wFpEC2x0ZZ","level":0,"time":"2023-01-28T10:47:48+00:00","remoteAddr":"lanadress118","user":"administartor","app":"encryption","method":"GET","url":"/index.php/settings/ajax/checksetup","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"MUg5b2naYMYFWeyIYfbF","level":0,"time":"2023-01-28T10:47:48+00:00","remoteAddr":"lanadress118","user":"administartor","app":"encryption","method":"PROPFIND","url":"/remote.php/dav/","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"O2KFC5CD1pCUi3ebtrBA","level":0,"time":"2023-01-28T10:47:48+00:00","remoteAddr":"lanadress118","user":"administartor","app":"encryption","method":"GET","url":"/index.php/apps/encryption/ajax/getStatus","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"Z8EbbaIHdvi441aguHjC","level":0,"time":"2023-01-28T10:47:48+00:00","remoteAddr":"lanadress118","user":"administartor","app":"encryption","method":"PROPFIND","url":"/remote.php/dav/","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"nOKvHk1TDpnYJ2a4Tbkw","level":0,"time":"2023-01-28T10:47:49+00:00","remoteAddr":"lanadress118","user":"user","app":"encryption","method":"PROPFIND","url":"/remote.php/dav/files/user/","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"3eWCENe1hahJSeMkoIqJ","level":0,"time":"2023-01-28T10:47:49+00:00","remoteAddr":"lanadress118","user":"administartor","app":"encryption","method":"GET","url":"/ocs/v2.php/cloud/groups/details","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"HhE79Tc5H7wFpEC2x0ZZ","level":1,"time":"2023-01-28T10:47:49+00:00","remoteAddr":"lanadress118","user":"administartor","app":"no app in context","method":"GET","url":"/index.php/settings/ajax/checksetup","message":"Deprecated event type for OCP\\IDBConnection::CHECK_MISSING_PRIMARY_KEYS: Symfony\\Component\\EventDispatcher\\GenericEvent is used","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":[]}
{"reqId":"HhE79Tc5H7wFpEC2x0ZZ","level":1,"time":"2023-01-28T10:47:49+00:00","remoteAddr":"lanadress118","user":"administartor","app":"no app in context","method":"GET","url":"/index.php/settings/ajax/checksetup","message":"Deprecated event type for OCP\\IDBConnection::CHECK_MISSING_INDEXES: Symfony\\Component\\EventDispatcher\\GenericEvent is used","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":[]}
{"reqId":"HhE79Tc5H7wFpEC2x0ZZ","level":1,"time":"2023-01-28T10:47:49+00:00","remoteAddr":"lanadress118","user":"administartor","app":"no app in context","method":"GET","url":"/index.php/settings/ajax/checksetup","message":"Deprecated event type for OCP\\IDBConnection::CHECK_MISSING_COLUMNS: Symfony\\Component\\EventDispatcher\\GenericEvent is used","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":[]}
{"reqId":"gn1nYD1JGjy6ZdaCnJML","level":0,"time":"2023-01-28T10:48:18+00:00","remoteAddr":"lanadress118","user":"administartor","app":"encryption","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"9Gsb0IPUgZ3pI1l5CqjK","level":0,"time":"2023-01-28T10:48:37+00:00","remoteAddr":"lanadress118","user":"user","app":"encryption","method":"PROPFIND","url":"/remote.php/dav/files/user/","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"8HNSPFQ3AIiZrRPXlOGx","level":0,"time":"2023-01-28T10:48:44+00:00","remoteAddr":"lanadress118","user":"user","app":"encryption","method":"PROPFIND","url":"/remote.php/dav/files/user/","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"CMpVZJ3vVSoG0PskCJxa","level":0,"time":"2023-01-28T10:48:48+00:00","remoteAddr":"lanadress118","user":"administartor","app":"encryption","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"jetfyuhJKC2iQ0ZgkNX3","level":0,"time":"2023-01-28T10:49:14+00:00","remoteAddr":"lanadress118","user":"user","app":"encryption","method":"PROPFIND","url":"/remote.php/dav/files/user/","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"C2DEyuGO7MuIbrhIjaTZ","level":0,"time":"2023-01-28T10:49:18+00:00","remoteAddr":"lanadress118","user":"administartor","app":"encryption","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"m4OOKHdqtGXBkStUgQY6","level":0,"time":"2023-01-28T10:49:39+00:00","remoteAddr":"lanadress118","user":"user","app":"encryption","method":"PROPFIND","url":"/remote.php/dav/files/user/","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"NOTo7jgG8ILI0oo9fICA","level":0,"time":"2023-01-28T10:49:44+00:00","remoteAddr":"lanadress118","user":"user","app":"encryption","method":"PROPFIND","url":"/remote.php/dav/files/user/","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"YaAefiVo2mnCeNfwB8ye","level":0,"time":"2023-01-28T10:49:48+00:00","remoteAddr":"lanadress118","user":"administartor","app":"encryption","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"5yErzATyAtcfO0h7mOUi","level":0,"time":"2023-01-28T10:50:13+00:00","remoteAddr":"lanadress118","user":"administartor","app":"encryption","method":"GET","url":"/index.php/settings/admin/logging","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"5yErzATyAtcfO0h7mOUi","level":0,"time":"2023-01-28T10:50:13+00:00","remoteAddr":"lanadress118","user":"administartor","app":"logreader","method":"GET","url":"/index.php/settings/admin/logging","message":"Could not find resource file \"/apps/logreader/css/../js/logreader-main.css\"","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"logreader"}}
{"reqId":"uGNZpYC8SlvAtzl2FCDy","level":0,"time":"2023-01-28T10:50:13+00:00","remoteAddr":"lanadress118","user":"administartor","app":"encryption","method":"GET","url":"/ocs/v2.php/search/providers?from=%2Fsettings%2Fadmin%2Flogging","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"JzGD2ROjA705oA6BQnpW","level":0,"time":"2023-01-28T10:50:13+00:00","remoteAddr":"lanadress118","user":"administartor","app":"encryption","method":"GET","url":"/index.php/apps/logreader/settings","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"t0f2vfp6b7NKJHjTltno","level":0,"time":"2023-01-28T10:50:13+00:00","remoteAddr":"lanadress118","user":"administartor","app":"encryption","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"WILsBDRo43xVWkSaCLaZ","level":0,"time":"2023-01-28T10:50:13+00:00","remoteAddr":"lanadress118","user":"administartor","app":"encryption","method":"GET","url":"/index.php/apps/encryption/ajax/getStatus","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"TN6tKvpKWLksoFV7fbId","level":0,"time":"2023-01-28T10:50:14+00:00","remoteAddr":"lanadress118","user":"user","app":"encryption","method":"PROPFIND","url":"/remote.php/dav/files/user/","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"jwH3Wj3nobOBByWj3iUE","level":0,"time":"2023-01-28T10:50:14+00:00","remoteAddr":"lanadress118","user":"administartor","app":"encryption","method":"GET","url":"/index.php/apps/logreader/get?offset=0&count=50&levels=00111","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"Up5xYF91rpDspnxU9q7q","level":0,"time":"2023-01-28T10:50:40+00:00","remoteAddr":"lanadress118","user":"user","app":"encryption","method":"PROPFIND","url":"/remote.php/dav/files/user/","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"IWpT2ddu7TMl1kMCbYn7","level":0,"time":"2023-01-28T10:50:43+00:00","remoteAddr":"lanadress118","user":"administartor","app":"encryption","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"XmUndXbZz6oQPwzXEK3E","level":0,"time":"2023-01-28T10:50:43+00:00","remoteAddr":"lanadress118","user":"user","app":"encryption","method":"PROPFIND","url":"/remote.php/dav/files/user/","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"25.0.3.2","data":{"app":"encryption"}}
{"reqId":"cDoyExmplusKdlCwprtQ","level":0,"time":"2023-01-28T10:50:45+00:00","remoteAddr":"lanadress118","user":"administartor","app":"encryption","method":"GET","url":"/index.php/settings/admin/log/download","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0","version":"25.0.3.2","data":{"app":"encryption"}}

This is what ChatGPT said:

To have the cron job that sends email notifications run every day, you can add the following line to the crontab file:
“0 0 * * * php -f /path/to/nextcloud/cron.php”

This will run the cron job every day at 00:00 (midnight) and execute the command “php -f /path/to/nextcloud/cron.php”

Alternatively, you can also adjust the email notification frequency settings on Nextcloud’s admin page. This can be done by going to the admin page, selecting the “settings” option, and adjusting the “Notification frequency” setting.

It’s important to note that if you change the cronjob schedule to run every day, you should also adjust the notification frequency setting in the Nextcloud’s admin page to match the schedule, otherwise you may end up with unexpected results."

To open the crontab file, use the command “crontab -e” as a superuser.

Hope that helps.

Seriously?

This is not a good solution because the cronjob does a lot more than just send notifications. The recommended frequency is every 5 minutes, which usually doesn’t need to be changed except for a few edge cases.

This is the right way to do it!

Also not true, the cronjob should run in the context of the user of the webserver, e.g. www-data.

crontab -u www-data -e

I would suggest to read the Nextcloud documentation instead of asking ChatGPT, especially if your intention is to help others here in the forum. Otherwise we could as well replace the forums with a ChatGPT bot :wink:

2 Likes

Exactly. We don’t need another, modern wave of „LMGTFY“. That’s why other communities start to block ChatBot usage already.

1 Like

Good point, the notification setting frequency setting change worked for me earlier and the crontab option sounded sensible to me. It may still work as superusers, but agree it is better to use www-data. I thought I would just mention my source, but will stop doing that and just verify myself if in doubt giving it the human touch :slight_smile: . Noticed the ChatGPT hints are good but not perfect.

thanks a lot, lets see if that fixes it :slight_smile: