You can find our user documentation at docs.cpanel.net.

Check out our new API beta site!

Child pages
  • UAPI Functions - Email::account_name
Skip to end of metadata
Go to start of metadata

Description

This function returns the provided value.

 This function works with other functions to display form data within a user interface. 

Note:

If you call this function from a Webmail session URL, the system will only access data for that email account. 

Important:

In cPanel & WHM version 76 and later, when you disable the Receive Mail role, the system disables this function.

Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Email/account_name?account=user
https://hostname.example.com:2083/cpsess##########/execute/Email/account_name?account=user%40example.com
https://hostname.example.com:2083/cpsess##########/execute/Email/account_name?account=&display=anyvalue



Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Return the user email account's email address.
$get_email_acct_info = $cpanel->uapi(
    'Email', 'account_name',
    array(
        'account'    => 'user',
        )
);
 
// Return the user@example.com email address's account username.
$get_email_acct_info = $cpanel->uapi(
    'Email', 'account_name',
    array(
        'account'    => 'user@example.com',
        )
);
 
// Return "All Mail On Your Account" if "account" is empty.
$get_email_acct_info = $cpanel->uapi(
    'Email', 'account_name',
    array(
        'account'    => '',
        'display'    => 'any_value',
        )
);


Note:

For more information, read our Guide to the LiveAPI System.


 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Return the user email account's email address.
my $get_email_acct_info = $cpliveapi->uapi(
    'Email', 'account_name',
    {
        'account'    => 'user',
    }
);
 
# Return the user@example.com email address's account username.
my $get_email_acct_info = $cpliveapi->uapi(
    'Email', 'account_name',
    {
        'account'    => 'user@example.com',
    }
);
 
# Return "All Mail On Your Account" if "account" is empty.
my $get_email_acct_info = $cpliveapi->uapi(
    'Email', 'account_name',
    {
        'account'    => '',
        'display'    => 'any_value',
    }
);


Note:

For more information, read our Guide to the LiveAPI System.


 Command Line
uapi --user=username Email account_name account=user
uapi --user=username Email account_name account=user%40example.com
uapi --user=username Email account_name account="" display=any_value


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{  
   "messages":null,
   "errors":null,
   "status":1,
   "metadata":{  

   },
   "data":"user@example.com"
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
accountstring

The function will return this value in the data return.

If you do not include this parameter, the function returns All Mail On The Account or a blank value.

Note:

The function does not validate this parameter's value.

  • A valid string.
  • An empty value.
user
displaystring

Include this parameter to cause the function to return All Mail On The Account if the account parameter is blank or does not exist.

If you do not include this parameter and the account value is blank or does not exist, the function returns a blank data value.

Any non-blank value.

any_value

Returns

ReturnTypeDescriptionPossible valuesExample
datastringThe account parameter's value.
  • A valid string.
  • All Mail On The Account
  • An empty value.

user@example.com