WebFacing™ – Email Accounts management for cPanel® WebFacing™ – Email Accounts management for cPanel®

WebFacing™ – Email Accounts management for cPanel®

Created by: Knut Sparhell

Rating:
Downloaded: 15k times

🕸️ By WebFacing™. Read, send, show, manage, list, create, add, remove or delete email accounts, old messages, forwarders and autoresponders.
One click read, send and manage all your emails without a login step. Update notification recipients. Backup and download your complete cPanel® account.

This plugin requires your site is hosted on a cPanel® equipped server.

It uses it’s UAPI through shell access by default, or via HTTP API. Using without shell_exec initially requires a temporary access token generated in the cPanel® native interface.

Translation ready. Ready translations are

  • Norwegian (bokmål)

Current features

  • NEW: Dashboard widget with three live graphic server memory usage and server load gauge charts (can eassily be minimized or hidden via Screen Options or programatically)
  • WP Block for frontend access user’s own Webmail
  • Bulk entry of forwarders and email accounts (as free trial only, very limited use)
  • Screen Options to select visible forms on New Email screen, saved for as user option (and per site for Multisite)
  • Shortcode [wf_cpanel_email_webmail] or as [wf_cpanel_email_webmail]My Email[/wf_cpanel_email_webmail] for frontend access user’s own Webmail
  • cPanel® API Tokens Management – needed in case shell_exec is not available or when accessing a remote server
  • Backup complete cPanel® hosting account to file, and download it
  • Restore account backup files by extracting it to a folder (experimental)
  • Semi automated migration to new email server, including setup of new accounts for users, with sending setup instructions, passwords and links to setup guides for most common email clients
  • Add 10 single Email Accounts per week (without Pro nag) — actually unlimited
  • Remove single/multiple Email Accounts
  • List mailboxes with number of messages for each box
  • Remove old messages from mailboxes (older than 52 weeks as default)
  • Shrink a mailbox (empty it)
  • Change storage quota for for email accounts
  • Add 20 forwarders per week (without Pro nag) — actually unlimited
  • Add/remove single/multiple Email Failure addresses or Blackhole addresses
  • Add/delete/edit email autoresponders (for, subject, body, from, start, stop, interval)
  • Send single cPanel® Email Account Instruction (Client Setup) to specfied address
  • Send multipe cPanel® Email Account Instructions (Client Setups) to yourself for distribution
  • Open your cPanel® Webmail app for selected account (single click/tap – no further login needed!)
  • Set/change Email Account passwords
  • Set Default Email Address (catch-all) as forwarder, failure or blackhole
  • View/change Notification/Contact Email Addresses
  • Access for any user to view and read their own emails, if given the cpanel capability (Use custom code or a Roles/Capabilities Manager plugin)
  • Support for subdomain email addresses when the main domain is a subdomain (only)

  • In case the shell_exec function is disabled in your server PHP configuration, create a token in native cPanel® interface and add one of these lines to your wp-config.php file, functions.php in your child theme, in Must-use plugin or a custom regular plugin

    • const WF_CPANEL_API_TOKEN = 'my-temp-api-token';
    • define( 'WF_CPANEL_API_TOKEN', 'my-temp-api-token' );
    • See Manage API Tokens in cPanel®
    • The WF_CPANEL_API_TOKEN constant may be removed when a new token is created and activated from the plugin admin page
  • Option to set the default visibility for users on New Email screen (users may still set their own preferences):

    • add_filter( 'wf-cpanel-email-new-email_user-option', static function( bool $default, string $option, int $user_id ) {
      if ( $option === 'wc-show-new-blackhole' /*or by $user_id*/ ) {
      $default = true/*false*/;
      }
      return $default;
      }, 10, 3 );
  • Option to allow other users than those with manage_options capability to manage email adresses, single- or multisite, one of the following:

    • add_filter( 'wf_cpanel_email_capability', static fn( string $cap ): string => $my_cpanel_email_cap );
    • add_filter( 'wf_cpanel_email_capability', static fn( string $cap ) => 'edit_published_pages' );
  • Option to allow other users than those with manage_options capability to see the dashboard widget, or remove it, one of the following:

    • add_filter( 'wf_cpanel_email_widget_capability', static fn( string $cap ): string => $my_cpanel_widget_cap );
    • add_filter( 'wf_cpanel_email_widget_capability', static fn( string $cap ) => 'edit_published_pages' );
    • add_filter( 'wf_cpanel_email_widget_capability', static fn( string $cap ) => 'do_not_allow' );
  • Option to alter the refresh interval in seconds for the dashboard widget, one of the following:

    • add_filter( 'wf_cpanel_email_widget_interval', static fn( int $interval ): int => $my_cpanel_widget_interval );
    • add_filter( 'wf_cpanel_email_widget_interval', static fn( int $interval ) => 45 );
  • Option to limit email addresses to current site domain, even for single site admins, one of the following

    • const WF_CPANEL_EMAIL_SITE_DOMAIN_ONLY = true;
    • define( 'WF_CPANEL_EMAIL_SITE_DOMAIN_ONLY', true );
    • add_filter( 'wf_cpanel_email_site_domain_only', '__return_true' );
    • add_filter( 'wf_cpanel_email_site_domain_only', fn() => true );
  • Multisite Network: Option not to limit email addresses to current subsite domain, for site admins that are not network (super) admins, one of the following:

    • const WF_CPANEL_EMAIL_SITE_DOMAIN_ONLY = false;
    • define( 'WF_CPANEL_EMAIL_SITE_DOMAIN_ONLY', false );
    • add_filter( 'wf_cpanel_email_site_domain_only', '__return_false' );
    • add_filter( 'wf_cpanel_email_site_domain_only', fn() => false );
  • Many optional parameters and API filters for the shortcode output, see includes/ShortCode.php until further tested and documented

  • If you want to access another user on the server, use one of the following

    • const WF_CPANEL_USER = 'my-username';
    • define( 'WF_CPANEL_USER', 'my-username' );
  • If you want to access a remote server, use one of the following

    • const WF_CPANEL_HOST = 'my-host';
    • define( 'WF_CPANEL_HOST', 'my-host' );
    • using WF_CPANEL_HOSTrequires WF_CPANEL_USER to also be defined
  • Automaticallly create new accounts when a new user is registered?
    add_action( ‘user_register’, static function( int $user_id, array $userdata ): void {
    // What to do just after the registraton here, like this (adds an email address that forwards to all users, a mailing list):
    if ( method_exists( ‘WebFacing\cPanel\UAPI’, ‘add_forwarder’ ) ) {
    \WebFacing\cPanel\UAPI::add_forwarder( ‘all-users@yoursite.tld, ‘$userdata[‘user_email’] );
    }
    }, 2 );

  • Site Health

    • Tests and information
    • Check auto detecting and current email routing in an extra Site Health tab (to any email address sent from your server)

Possible future features

  • Scheduled automatic removal of old messages in/from mailboxes
  • Import migration list for create account, send instructions and password to current address
  • Delete selected email messages from mailboxes (by selectd message age etc.)
  • Suspend/unsuspend incoming/outgoing for email accounts (if requested)
  • Suspend/unsuspend login to email accounts (if requested)
  • Domain level email forwarding
  • Domain Managament
  • DNS Zone editing

Limitations, security, privacy – be warned

  • Maximum New Forwarders = 20, Maximum New Accounts = 5, weekly reset
  • Trial: Maximum New Forwarders as bulk entry = 4, Maximum New Accounts as bulk entry = 2
  • Now works without shell access! Will not work at all if shell_exec is disabled in php.ini
  • Works only for admins, or other users with a custom cpanel capability and email on site domain (so far)
  • Any admin (if multisite, only network admins), or user with the filtered capability, on a site, can fully access any account on the cPanel® server instance
  • No AYS warnings for delete actions
  • If several sites/admins share the same cPanel® account, without being part of a WP Multisite network, no bulletproof separation, because of the way the cPanel® UAPI CLI works, with or without this plugin

Pro Addon

  • Pro Addon plugin was released May 1, 2023 at https://webfacing.eu/plugin/wf-cpanel-email-accounts-pro/ and will unlock in bulk entry new forwarders and new accounts to the numbers in the purchesed license

Screenshots

  • Accounts Overview in admin
  • Add forwarders (aliases), failures or full accounts
  • Email sendt to existing email upon new account creation (optional)
  • Your page button example using Webmail block or shortcode <code>[wf_cpanel_email_webmail]</code> (text and styling friendly, filterable CSS classes)
  • Batch Entry

Categories

Get New Themes & Resources