Disable setting "add new Mail-Account"

Hello,
we have integrated the mail app into the Nextcloud of our school (900 users).
We have specified the school mail account for all users via the admin mail settings. Works!

Now, however, the students are integrating external accounts (GMX, Hotmail, …) via IMAP, which the data protection officer at the school see as critical.

Could this option be activated / deactivated in the new version using the global setting as admin?

Further problems:

  1. The groups from the app “Circels” are not available in the mail app Sending New Mail “TO”.
  2. When I click on “Send Mail” in the “Contacts” app, the mail app does not open, but my external mail program.
  3. The useres and groups are not available in the mail app Sending New Mail “TO” (see older thread).

Best regards
Patrick

1 Like

Maybe @ChristophWurst can comment here?

Hi Patrick,

this feature request makes sense. You may open a ticket for this at https://github.com/nextcloud/mail/issues/new?assignees=&labels=enhancement%2C+0.+to+triage&template=feature_request.md&title=, though we won’t have any resources to add such a feature at the moment.

If you know anyone who’s a developer and could help with this let us know.

Cheers

Thanks @rakekniven. I’m actually subscribed to all new topics here so I get a notification anyway. I just try not to work on the weekends, that is why I’m sometimes slow with my responses :slight_smile:

Ok, try to remember that next time :wink:

I can understand that well

Did anyone already open a feature request for that? I need this feature, too.

I don’t think so.

Bump ----^

I found this issue #5759 (nextcloud/mail). But no text since 30. Nov. 2021 there. Today i gave the issue a thumbs up. :+1::wink:

I really needed this functionality so i performed this hack in my config.php:

$user = !empty($_COOKIE['nc_username']) ? $_COOKIE['nc_username'] : '';
if (empty($user) && !empty($_SERVER['PHP_AUTH_USER']) ) {
  $user = $_SERVER['PHP_AUTH_USER'];
}
else if (empty($user) && !empty($_SERVER['REQUEST_URI']) && preg_match('/\/(dav\/files|users?)\/([^\/]+)/',$_SERVER['REQUEST_URI'],$matches) ) {
  $user = $matches[2];
}
else if (empty($user) && strpos($_SERVER['PHP_SELF'],'/cron.php') > 0 ) {
  $user = '> CRON call <';
}
if (  !empty($user) && $user != '> CRON call <' 
############### exclude your users here that do get access #
 && ($user != 'admin_user' && $user != 'another_admin_user')
############################################################
 && strpos($_SERVER['PHP_SELF'],'/mail/') > 0 # or put 'mail/setup' here if you want to disable the ability to create/add a mail account
) {
 die('you have no access to this part of the site'); 
}

This works perfectly for my needs (I do think I’ll need to keep an eye out for my config.php when I run an update… :wink: )

note: the config.php is in your main web-folder named ‘config’

@Eesger
Can you post the name and path of the file? config.php ???!!!???
Then i post it in the issue.

I added a note, but one needs the config.php to set up Nextcloud, so I thought it to be superfluous …

PS: I already commented on github

Unfortunately, I still don’t understand which config.php you mean. Can you post the installation guide you used?

The config.php seemed the best place to me to put the code

The config.php info on docs.nextcloud:
https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html

Yes. But config/config.php is in JSON format. And you post a shell script. Sorry i do not understand it.

The config.php starts with:

<?php

Then you see:

$CONFIG = array (
........
);

In between one could place any legitimate PHP-code :wink:

Ok. i thought only JSON is possible. When is this executed at all or how often is the file read? In this file I would have hidden probably last a program. :wink:

config.sample.php

I think there are better places in GitHub - nextcloud/mail: 💌 Mail app for Nextcloud

The config.php contains the variables for Nextcloud to function… like database passwords etc.
Therefore, this file is read absolutely always with every possible call to the Nextcloud software…

Oh yes. The php scripts needs the access to the database. Actually quite logical. Years ago I wrote applications myself that needed access to a database. :wink: