Setting some configuration for all email accounts

Arvy

Well-Known Member
Oct 3, 2006
148
11
168
Brazil
cPanel Access Level
Root Administrator
Twitter
Hello,

I need to create 271 email accounts in a new cPanel account. I'll use /scripts/addpop in a script to do this.

But I want to change, for all email accounts, some extra configuration:

- Disable Plus Addressing
- Set "Open my inbox when I log in" by default, to user go directly to webmail (server has only Roundcube)
- (optional) Set default Roundcube auto-check time from 1 to 3 minutes

I can do scripts to change this, but I need to know where (files) to edit and set this.

Thanks a lot!
 
Last edited:
  • Like
Reactions: Gino Viroli

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,301
363
Houston
- Disable Plus Addressing

For plus addressing - you can't disable the actual plus addressing itself but you can disable automatic folder creation which will send emails sent to plus addresses to the INBOX

Set "Open my inbox when I log in" by default, to user go directly to webmail (server has only Roundcube)
I answered this in another thread this morning I believe you commented on: Disable "Webmail Home" icon in webmail toolbar

(optional) Set default Roundcube auto-check time from 1 to 3 minutes
Can you explain what you mean by this?
 

Arvy

Well-Known Member
Oct 3, 2006
148
11
168
Brazil
cPanel Access Level
Root Administrator
Twitter
Hello @cPanelLauren

This "/home/$username/.cpanel/nvdata/[email protected]_tld_default_webmail_app" resolve the "Open my inbox when I log in" for me. Thanks.

About "Automatically Create Folders for Plus Addressing", you're right, I want to disable this using a script for all 271 accounts.

About Roundcube, 1 minute is the default time to check for new email. I want to change to 3 minutes, using a script too, in all 271 email accounts.

Thanks
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,301
363
Houston
About "Automatically Create Folders for Plus Addressing", you're right, I want to disable this using a script for all 271 accounts.
@Arvy the UAPI Function here should disable this for you: https://documentation.cpanel.net/display/DD/UAPI+Functions+-+Email::disable_mailbox_autocreate
You'd need to create a loop to loop through all the accounts on the server

About Roundcube, 1 minute is the default time to check for new email. I want to change to 3 minutes, using a script too, in all 271 email accounts.
There's no UAPI function for webmail changes such as this. So, this is listed in the following files:

Code:
[[email protected] config]# grep -ir refresh_interval /usr/local/cpanel/base/3rdparty/roundcube/config/
/usr/local/cpanel/base/3rdparty/roundcube/config/default.inc.php.orig:// Minimal value of user's 'refresh_interval' setting (in seconds)
/usr/local/cpanel/base/3rdparty/roundcube/config/default.inc.php.orig:$config['min_refresh_interval'] = 60;
/usr/local/cpanel/base/3rdparty/roundcube/config/default.inc.php.orig:$config['refresh_interval'] = 60;
/usr/local/cpanel/base/3rdparty/roundcube/config/config.inc.php:// Minimal value of user's 'refresh_interval' setting (in seconds)
/usr/local/cpanel/base/3rdparty/roundcube/config/config.inc.php:$config['min_refresh_interval'] = 60;
/usr/local/cpanel/base/3rdparty/roundcube/config/config.inc.php:$config['refresh_interval'] = 60;
/usr/local/cpanel/base/3rdparty/roundcube/config/defaults.inc.php:// Minimal value of user's 'refresh_interval' setting (in seconds)
/usr/local/cpanel/base/3rdparty/roundcube/config/defaults.inc.php:$config['min_refresh_interval'] = 60;
/usr/local/cpanel/base/3rdparty/roundcube/config/defaults.inc.php:$config['refresh_interval'] = 60;
But I need to point out that customizations made to roundcube like this aren't supported by cPanel and I can't guarantee that changes made in any of these files will remain once the file is updated with a cPanel update.

You might also want to look at roundcube's site for making changes roundcube/roundcubemail
 
  • Like
Reactions: Arvy

Gino Viroli

Well-Known Member
Oct 2, 2007
97
10
58
cPanel Access Level
Root Administrator
  • Like
Reactions: cPRex

nsgnet

Registered
Apr 28, 2022
2
1
3
Romania
cPanel Access Level
DataCenter Provider
In case of someone consider this useful, I've created a script to disable on all email accounts the functionality "Automatically Create Folders for Plus Addressing". I've tried to find a better way searching through the forum, but couldn't find it. I didn't spend much time to parse the output in a nice format.
Although I would have seemed normal to have this functionality implemented in Whm and the option to allow you to set the default value of "Automatically Create Folders for Plus Addressing" to new accounts, but maybe the impact isn't known to everyone right now.
Code:
#!/bin/bash

function list_user_mailboxes() {
    uapi --user="${1}" Email list_pops 2>/dev/null | grep 'email:' 2>/dev/null | awk -F': ' '{print $2}'
}

function disable_bulk_mailbox_autocreate() {
    for user in $(users); do
        mailboxes=$(list_user_mailboxes ${user})
        for email in ${mailboxes}; do
            uapi --user="$user" Email disable_mailbox_autocreate email="$email"
        done
    done
}

function users() {
    whmapi1 list_users | grep '\ - ' | awk -F'- ' '{print $2}'
}

disable_bulk_mailbox_autocreate
 
  • Like
Reactions: cPRex