This function lists the mail directory's subdirectories (boxes) and files.


$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
// List the mail-related subdirectories in mail/
$list_mailboxes = $cpanel->uapi(
    'Email', 'browse_mailbox',
        'dir'           => 'mail/',


my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
# List the mail-related subdirectories in mail/
my $list_mailboxes = $cpliveapi->uapi(
    'Email', 'browse_mailbox',
        'dir'           => 'mail/',


<!-- Get a hash of data, then display the full path for each item. -->
[% data = execute('Email', 'browse_mailbox', { 'dir' => 'mail/' } ) %]
[% FOREACH q = data.fullpath %]
         [% q %]
[% END %]
<!-- Get only the full paths. -->
[% execute('Email', 'browse_mailbox', { 'dir' => 'mail/' } ).data.fullpath %]


uapi --user=username Email browse_mailbox



If you do not use any input parameters, the function returns a list of items in the cPanel account's main mail directory.

ParameterTypeDescriptionPossible valuesExample

An email address, to limit the function's results.

A valid email address on the cPanel account.

A mail directory name, to limit results to specific directories.

A valid directory on the cPanel account.

If you pass the default or mail values, the function lists information for all mail directories. 


Whether to include hidden files and directories.

This value defaults to 0.

  • 1 — Include hidden items.
  • 0 — Do not include hidden items.


ReturnTypeDescriptionPossible valuesExample
mtimestringThe item's modification time.A time, in Unix time format.
isleafBooleanWhether the item is a file or a directory.
  • 1 — File.
  • 0 — Directory.
filestringThe item's base name.A valid file or directory name.archive
pathstringThe item's directory's path.

The absolute path to the item's home directory.

depthintegerThe directory depth of the item's path.A positive integer.2
relpathstringThe item's relative path.The directory path to the item, relative to the mail directory./archive
ismailboxBooleanWhether the item is a mailbox.
  • 1 — Mailbox.
  • 0Not a mailbox.
fullpathstringThe item's absolute path.The absolute path to the item./home/example/mail/archive
typestringThe item type.
  • dir — The item is a directory.
  • file — The item is a file.