Autodelete WebMail users on cPanel
If you have WebMail Pro installed on cPanel, you can log into WebMail using any email account which exists on cPanel. There is no need to add user in admin area of WebMail Pro manually, user account will automatically be created in WebMail database.
However, if email account is deleted on cPanel, WebMail Pro has no way to tell that it's deleted, so user account will stay in WebMail database even though it's no longer usable.
The following guidelines offer a way to install a hook on cPanel, ensuring that user account will be automatically deleted from WebMail once the email account is deleted on cPanel.
NB: WebMail Pro can be installed on cPanel server using either cPanel installer, or from a standard package. These guidelines work for both the methods - however, you will need root access to cPanel to perform this kind of configuration.
-
Download the script, unpack it and place it under dev/ subdirectory of your WebMail Pro installation - or any other direct subdirectory under the installation root. The scripts must have root:root ownership and 755 permissions.
- Run the following command in cPanel console, as root:
/usr/local/cpanel/bin/manage_hooks add script /usr/local/cpanel/base/3rdparty/afterlogic/tcpanel/remove_user.php --manual --category Cpanel --event 'UAPI::Email::delete_pop' --stage post
with the correct path to remove_user.php
script specified.
- Log into cPanel as root and make sure the hook is added correctly:
For troubleshooting purposes, you can enable debug logging, a special log will be generated under logs directory, filename starting with cpanel- .