The copy_user_mail_as_root Script
Valid for versions 96 through the latest version
Version:
96
Last modified: 2021 March 19
Overview
The /usr/local/cpanel/scripts/copy_user_mail_as_root script copies a cPanel account’s mail to or from a remote server as the root user. After you run the script, it will prompt for a root API token on the remote server.
Run the script
To run this script on the command line, use the following format:
/usr/local/cpanel/scripts/copy_user_mail_as_root [options]Options
Use the following options with this script:
| Option | Description | Example | 
|---|---|---|
| --mode | Required  Whether to copy the account’s mail to the local server or a remote server: 
 | --mode=toremote | 
| hostname | Required The hostname to copy the account’s mail to or from. | example.com | 
| username | Required The cPanel account’s username. | exampleuser | 
| --help | Display the script’s help documentation | --help | 
Example
The following example uploads the exampleuser account’s mail to the example.com remote server:
/usr/local/cpanel/scripts/copy_user_mail_as_root --mode=toremote example.com exampleuser