Email Activity Notification

Hello,
We have recently sent up NextCloud Lab Testing environment which contains the following;
8x Centos 7.2 Operating system, Installed base packages
4x GlusterFS Servers, using Distribution/Replication Volume
2x MariaDB Galera Cluster Servers
2x Nextcloud Web Servers
We are looking for a much larger scaled out version for our customer to use.
Nextcloud works very good, and easy to setup with no problems.
My concern is the Email Notifications, which are in “Personal” settings called Send emails: hourly.
Tried a couple of different ways to send email alerts immediately. The Test Email was very responsive. I received the test Email from Nextcloud within 1 minute, No problems.
Adjusting crontab to execute every 5 minutes instead of 15, No joy.
I looked into php.ini file for any type of configuration to send NextCloud notification quicker, No joy.
Maybe I not looking in the right configuration file to adjust when notification are sent, any help would be appreciated.
Thank you in advance

Hello,

I do not believe there is a method to notify more than once a hour. I think this would be a feature request in the activity module. See https://github.com/nextcloud/activity/issues

I found the code I want to change;

Root# vi /var/www/html/apps/activity/templates/personal.php

<?php p($l->t('Send emails:')); ?>

<option value=“0”<?php if ($_['setting_batchtime'] === \OCA\Activity\UserSettings::EMAIL_SEND_HOURLY): ?> selected=“selected”<?php endif; ?>><?php p($l->t('Hourly')); ?>
<option value=“1”<?php if ($_['setting_batchtime'] === \OCA\Activity\UserSettings::EMAIL_SEND_DAILY): ?> selected=“selected”<?php endif; ?>><?php p($l->t('Daily')); ?>
<option value=“2”<?php if ($_['setting_batchtime'] === \OCA\Activity\UserSettings::EMAIL_SEND_WEEKLY): ?> selected=“selected”<?php endif; ?>><?php p($l->t('Weekly')); ?>

Wondering if i can change the following code as;

select id=“notify_setting_batchtime” name=“notify_setting_batchtime”>
<option value=“0”<?php if ($_['setting_batchtime'] === \OCA\Activity\UserSettings::EMAIL_SEND_MINUTE): ?> selected=“selected”<?php endif; ?>><?php p($l->t('Hourly')); ?>
<option value=“1”<?php if ($_['setting_batchtime'] === \OCA\Activity\UserSettings::EMAIL_SEND_HOURLY): ?> selected=“selected”<?php endif; ?>><?php p($l->t('Daily')); ?>
<option value=“2”<?php if ($_['setting_batchtime'] === \OCA\Activity\UserSettings::EMAIL_SEND_DAILY): ?> selected=“selected”<?php endif; ?>><?php p($l->t('Weekly')); ?>

If I can get it to work like that?

It’s not that easy, the code needs to know EMAIL_SEND_HOURLY. You would need to modify this file as well:

The proper thing to do would be to officially add an option to send the mail every 15 minutes or even each minute. Please note that the cronjob triggers the mail notification so its run interval must be as short as your notification interval (a minute might be very short).

Workaround: Go to your database. In the user-settings, there is a variable where the interval is set in seconds (3600), you can manually change that (table oc_preferences has the notify_setting_batchtime). Then also shorten your cronjob interval.

Its this section of the code.

Easiest Option: missuse the default “hourly” and shorten the first row (default).

But: you are speaking of a big scale setup.
After you did this tweak the integrity check will fail because the file was modified.
Not shure if you want do disable this in a non-test-environm.

Next option: fork the app to your own one and modify it - worst option

Better option: request another timeframe in the Git for the app

Best Option: open a pull request with the suggested code for a new option in the dropdown&controller which only needs to get merged. Its a 5 min task

email_batch_time = 3600;
		if ($notify_setting_batchtime === UserSettings::EMAIL_SEND_DAILY) {
			$email_batch_time = 3600 * 24;
		} else if ($notify_setting_batchtime === UserSettings::EMAIL_SEND_WEEKLY) {
			$email_batch_time = 3600 * 24 * 7;
1 Like

Just for testing purposes, I shorted the time frame from 3600 to 900 (i.e 15 minutes) through phpmyadmin. and deceased the time for my cron job to ten minutes. This worked good, no problems yet. What I do not understand is that why would there be and “hour” delay in notification. If the material that is shared might be important one must wait an hour to be notified. Thank you for the reply, this helped.

There still is an hour delay (did you experience that)? If this is information in the official doc, this is because the shortest interval by default is 60 min.

To be exact it was 23 minutes until I received my Email Notification
I configured Cron to run every 10 minute, config Database from 3600 to 900. Still not exactly what I want.

A post was split to a new topic: No notification mails are sent

But it seems to do what it is supposed to do: You created your event that triggers a notification at t=0. The cronjob then runs at t=3min, time is shorter than your 15 min. Next cronjob runs at t=13 min, it’s still less than 15 mins. Then it runs again at t=23mins and the mail is sent.

Hello,
I Know this is an old post, I see now my problems have been solved by Nextcloud as shown below.
Thank for the fix…

Hello there !
Waking up an old post but I have a request.
Would it be possible to force this parameter for all users ? I’m facing an issue where I changed this parameter in the administration configuration area, but it kept the old setting for all of my current users, so that’s really annoying.

@MAXOUXAX

Good question,
The settings are in the “Personal” Section for the user/s so I’m not sure.

Yeah I know, but the activity app has this feature, and if not forced, users can change the settings only for them.

@MAXOUXAX
Did some research on this, now I understand. Kind of odd Administrator Section have settings for activity and Personal Section also. When setting are configured in Admin section it does not effect the users.
Not sure what the perpose of having these settings in two different place when users are free to adjust there own settings. Maybe a bug.
Maybe a feature request https://github.com/nextcloud/activity/issues

1 Like

Oh sorry I didn’t mean in the activity app (because you obviously cannot force these admin parameters), I meant the apporder app, which allows administrators to check “force this parameter for all users” and it does work.
So yeah I think it could be something nice to have on the activity app.

@GSmitt
very interested in this -
do I understand you right, that there must be personal settings for activity notifications and additionally general settings (done by the admin), with which I (admin) can overwrite the personal settings of the ‘normal’ users?

Edit: I think I found it …

admin/any user > Settings > Personal > Activity >> those are the personal admin/user settings

admin > Settings > Administration > Activity >> those must be the general settings, that overwrite personal user settings

own answer:

nope … this cannot be

in the line under >admin > Settings > Administration > Activity > Default settings
it says:

‘Configure the default notification settings for >new< users.’

So I assume these settings don’t overwrite the personal user settings