Disable "Webmail Home" icon in webmail toolbar

swbrains

Well-Known Member
Sep 13, 2006
306
45
178
Hi,

In the cPanel 84.0.19 webmail interface, I want to disable/hide the "Webmail Home" ("CP") icon/link in the upper-right corner of the webmail UI for all accounts/users. How can I do this?

In a related question, I can disable Forwarders in the webmail UI if I disable it in the Feature Manager, but then it's also not available to my scripts that call the API for forwarder functions. Is it possible to have forwarding available on the account but not accessible in webmail (i.e. just hidden/disabled for webmail only)? I have a UI for managing forwarders that I present to my users. I don't want them to change anything by circumventing it by modifying forwarders through webmail.

I guess if I can disable or hide the Webmail Home (CP) icon on the toolbar, question #2 is a moot point as it seems you need to use that icon/link to get to the Forwarder setup in webmail. Help with either question is appreciated.

Thanks!
 
Last edited:

swbrains

Well-Known Member
Sep 13, 2006
306
45
178
I found my answer on the web. I'm updating here with what I found so it will be available to others who search the same question. With regard to customizing the Roundcube user interface:

To remove the cPanel icon/link from the webmail header toolbar that allows returning back to the webmail home page:
FOLDER: /usr/local/cpanel/base/3rdparty/roundcube/config
FILE: config.inc.php
CHANGE LINE: $config['plugins'] = array('cpanellogin','cpanellogout','archive','calendar');
MODIFICATION: remove "return_to_webmail" plugin from list

To modify the logo
FOLDER: /usr/local/cpanel/base/3rdparty/roundcube/config
FILE: config.inc.php
CHANGE LINE: $config['skin_logo'] = "[relative path to your_logo_image.png]";
 

swbrains

Well-Known Member
Sep 13, 2006
306
45
178
Ok, so while the above changes work in Roundcube, there's still an issue with the first-time webmail login taking the user to the cPanel webmail home page. I'd like webmail login to take the user directly to Roundcube after successful login, but I can't figure out how to do that. There appears to be a "goto_uri" variable being passed around as the location to direct to after login but I can't see where to set it to a default value that somehow points to the Roundcube app.
 
  • Like
Reactions: Arvy

Arvy

Well-Known Member
Oct 3, 2006
148
11
168
Brazil
cPanel Access Level
Root Administrator
Twitter
Ok, so while the above changes work in Roundcube, there's still an issue with the first-time webmail login taking the user to the cPanel webmail home page. I'd like webmail login to take the user directly to Roundcube after successful login, but I can't figure out how to do that. There appears to be a "goto_uri" variable being passed around as the location to direct to after login but I can't see where to set it to a default value that somehow points to the Roundcube app.
Looking for a way to do this too. And disable Plus Addressing.
I need to create 271 accounts (using /scripts/addpop in a script), but I need users go directly to Roundcube to avoid support tickets flood (migrating from Sentora).
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
Hi @swbrains

That method will work and I'm glad you found the solution you were looking for, for the most part, but may I ask why you wanted it removed?

You can also remove horde if you don't use it by going to WHM>>Server Configuration>>Tweak Settings -> Enable Horde Webmail

This thread discusses setting the default : skip "choose a default webmail application" screen - log directly into webmail

as well as this one: Choose a Default Webmail Application

This one discusses setting it for all users: Mass Update Default Webmail

There was a feature request for this completed here: https://features.cpanel.net/topic/default-webmail-without-prompt - though it only completes it from the user standpoint, not for the provider wanting to eliminate the choice from the beginning
 

swbrains

Well-Known Member
Sep 13, 2006
306
45
178
Hi,

The reason I want it removed is our websites provide our own user interface to create forwarders, and we don't want our customers using forwarders from the cPanel interface for POP accounts. I tried disabling the Forwarding Manager in the account package, but it also disabled forwarders from being used via our scripts, which we need in order to provide our own user interface for managing them. We really just need them disabled or hidden from the POP account webmail page. Hiding the entire cPanel "home" page for webmail is actually perfect for us -- we just want them to see the webmail client (Roundcube) after login.

I had previously disabled Horde, so only Roundcube shows on the cPanel webmail home page. But it still shows that page which allows the user access the other function(s).

I will check out the thread you linked to about creating/modifying that special file that configures a default webmail app for each POP account. That may work for us as we already use a custom script to create POP accounts from our own user interface.

Thanks!

UPDATE: Created the '_default_webmail_app' file in my script when adding/updating a POP account and it works great... defaults right into roundcube now upon login. Thanks again!
 
Last edited:
  • Like
Reactions: cPanelLauren

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
Hey @swbrains

Also, if you don't want your users to be able to create forwarders, you can disable that feature from their package's feature list as well. These can be managed from WHM>>Packages>>Feature Manager -> Edit Feature List -> Forwarder Manager.
 

swbrains

Well-Known Member
Sep 13, 2006
306
45
178
I tried disabling the Forwarding Manager in the account package, but it also disabled forwarders from being used via our scripts, which we need in order to provide our own user interface for managing them.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
I tried disabling the Forwarding Manager in the account package, but it also disabled forwarders from being used via our scripts, which we need in order to provide our own user interface for managing them.
I don't believe it inhibits the function of forwarders as a whole but it would prevent that user from adding them, which if you're using a script such as the one you're noting it would cause an issue.
 

swbrains

Well-Known Member
Sep 13, 2006
306
45
178
One of the links above references using the NVData API which I would like to use rather than create files manually in case their location changes in future versions. However, the thread linked above provides an example using the NVData API which is now reported in the documentation as depricated. It refers to the Personalization API instead. However, I can't figure out how to set up the "personalization" parameter hash so it refers to the POP account (filename) and the data (roundcube) that I want to set. I understand how to create a hash in Perl, I'm just not sure how to implement the personalization API hash parameters in such a case where I want to set the default webmail app. Can you provide some clarity with regard to this usage? Thanks!
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
Hi @swbrains

I feel like this is unnecessarily complicated in that documentation. To set the default webmail app the personalization function should look like the following:

Code:
echo '{"personalization":{"[email protected]_default_webmail_app":"roundcube"}}' | uapi --user=lauren --input=json --output=json Personalization set
I tested this on my own account by creating [email protected], confirming that the default_webmail_app file didn't exist (to ensure it will automatically create it when it doesn't), and running the personalization::set function as follows:

Code:
[root@server nvdata]# echo '{"personalization":{"[email protected]_default_webmail_app":"roundcube"}}' | uapi --user=lauren --input=json --output=json Personalization set
[2020-01-21 15:47:45 -0600] info [uapi] ---debug_hooks---
[2020-01-21 15:47:45 -0600] info [uapi]             msg: No hooks found for 'pre' stage of context
[2020-01-21 15:47:45 -0600] info [uapi]         context: Cpanel::UAPI::Personalization::set
[2020-01-21 15:47:45 -0600] info [uapi]           stage: pre
[2020-01-21 15:47:45 -0600] info [uapi]          result: 0
[2020-01-21 15:47:45 -0600] info [uapi]            data: []
[2020-01-21 15:47:45 -0600] info [uapi] ---debug_hooks---
[2020-01-21 15:47:45 -0600] info [uapi]             msg: No hooks found for 'post' stage of context
[2020-01-21 15:47:45 -0600] info [uapi]         context: Cpanel::UAPI::Personalization::set
[2020-01-21 15:47:45 -0600] info [uapi]           stage: post
[2020-01-21 15:47:45 -0600] info [uapi]          result: 0
[2020-01-21 15:47:45 -0600] info [uapi]            data: []
{"apiversion":3,"module":"Personalization","func":"set","result":{"metadata":{},"messages":null,"data":{"personalization":{"[email protected]_default_webmail_app":{"reason":"OK","success":1,"value":"roundcube"}}},"errors":null,"status":1,"warnings":null}}[root@server nvdata]# ls -lah
total 92K
I confirmed it created the file and added roundcube to it:

Code:
[root@server nvdata]# stat test\@mydomain.us_default_webmail_app
  File: ‘[email protected]_default_webmail_app’
  Size: 9             Blocks: 8          IO Block: 4096   regular file
Device: fd01h/64769d    Inode: 2360515     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/  lauren)   Gid: ( 1002/  lauren)
Access: 2020-01-21 15:47:45.725510506 -0600
Modify: 2020-01-21 15:47:45.725510506 -0600
Change: 2020-01-21 15:47:45.725510506 -0600
 Birth: -
Code:
[root@server nvdata]# cat test\@mydomain.us_default_webmail_app
roundcube

I hope this helps.
 

swbrains

Well-Known Member
Sep 13, 2006
306
45
178
Follow-up to this thread with regard to removing the "Webmail Home" icon from the webmail toolbar:

I was successful doing this earlier by removing the "return_to_webmail" plugin from the list in the file "config.inc.php", but it appears perhaps a Roundcube update may have occurred that overwrote my change since the "Webmail Home" icon has returned to the webmail page. I was able to remove it again following the same steps I used earlier, but I'm wondering if there's a way to make this type of configuration change such that it would persist through Roundcube updates.
 

swbrains

Well-Known Member
Sep 13, 2006
306
45
178
Hi @swbrains

If you are referring to the problem of persisting my custom changes to config.inc.php after Roundcube udpates, I did it by creating a script named "postupcp" in /usr/local/cpanel/scripts. This script gets run after upcp runs, hence, after any Roundcube updates:

Code:
#!/bin/bash
echo Updating RoundCube Customizations...
sed -i "s/\$config\['plugins'\] = array.*/\$config\['plugins'\] = array\('cpanellogin','cpanellogout','archive','calendar'\);/i" /usr/local/cpanel/base/3rdparty/roundcube/config/config.inc.php
echo RoundCube Customizations Complete!
This basically just replaces the line in config.inc.php that initializes the Roundcube plugins with my custom list of plugins that I want to use (thus, omitting the "return_to_webmail" plugin from the list) . The replacement pattern in that regex may need to be adjusted depending on your particular needs.

Hope this helps!
 
  • Like
Reactions: cPanelAnthony

kozmonaut

Member
Dec 25, 2021
8
1
3
Brasil
cPanel Access Level
Root Administrator
Hi @swbrains
Thank you very much for the reply and for the script.

If possible, I wanted to ask you two things.

Since you removed the "Webmail Home" button I believe you probably also added the password plugin to Roundcube so that your users can change their password within Roundcube.
In case you have added it, how did you make config.inc.php plugin file remain after the update, since when updating Roundcube it ceases to exist?

Now a curiosity, does the '_default_webmail_app’ file you created for your script make all accounts automatically open directly in the roundcube after login?
If it's not asking too much, I'd love to use a script that automates all accounts opening directly in Roundcube.

I had never worked with scripts on WHM before, but because of your post I was really looking forward to doing some stuff.
Thanks!
 

swbrains

Well-Known Member
Sep 13, 2006
306
45
178
I didn't add the password plugin to Roundcube since our customers don't access cPanel (we're not a typical hosting service). However, I would assume you could use the script I posted earlier and include the password plugin along with the other plugins specified in the array to be updated in the regex.

The default_webmail_app file is specific to each email account, I believe. To set for all accounts, you would need to write a script that gets a list of all email accounts and then loops over them and calls the Personalization UAPI function:

cPanel Personalization UAPI Documentation

You would set up the JSON object you pass in as shown on the page linked above, but include an item for the email account setting its value to 'roundcube':

Code:
{ "personalization": { "[email protected]": "roundcube" } }
See Post #11 above for more information about this API function.
 

kozmonaut

Member
Dec 25, 2021
8
1
3
Brasil
cPanel Access Level
Root Administrator
Hi, @swbrains
As I said above, the problem is that the config.inc.php file doesn't originally exist in the Roundcube password plugin folder (originally there is only the config.inc.php.dist file which I then rename to config.inc.php and I make the changes). So I don't think I would be able to use sed in this case because it won't find it, as config.inc.php disappears with every update. Most likely there is a solution, but my knowledge is nil.

Thanks for the tip of default_webmail_app, as I'm a layman in scripts I will manually select each account created to open directly in RoundCube, since all my client emails are then inside my cPanel account.

Thanks.
 

swbrains

Well-Known Member
Sep 13, 2006
306
45
178
Sorry, I'm only aware of one config.inc.php in the /usr/local/cpanel/base/3rdparty/roundcube/config folder. I'm not sure what the "Roundcube password plugin folder" is or why there would be a second config.inc.php file located there.
 
Last edited:

kozmonaut

Member
Dec 25, 2021
8
1
3
Brasil
cPanel Access Level
Root Administrator
Yes... There is a config.inc.php.dist file that I rename to config.inc.php and change some things (to make the password plugin work) inside /usr/local/cpanel/base/3rdparty/roundcube/plugins/password