Child pages
  • cPanel API 2 Functions - Email::browseboxes

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

This function retrieves a list of the mail directory's subdirectories (boxes) and files.


Warning
titleWarning:

We strongly recommend that you use the following UAPI function instead of this function:

  • Email::browse_mailbox

    Excerpt Include
    DD:UAPI Functions - Email::browse_mailbox
    DD:UAPI Functions - Email::browse_mailbox
    nopaneltrue

Multiexcerpt include
SpaceWithExcerptcom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@12665
MultiExcerptNameAPIDisabledReceiveMailRole
PageWithExcerptLIB:_ServerRoleDisabledAPI

Panel
bgColor#F2F2F2
borderStylenone

Examples


Panel
bgColor#FFFFFF
borderStylenone


Expand
titleWHM API (JSON)


Code Block
languagetext
https://hostname.example.com:2087/cpsess##########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Email&cpanel_jsonapi_func=browseboxes&account=user@example.com

Include Page
LIB:_CallFromWHMAPILink
LIB:_CallFromWHMAPILink


Expand
titleLiveAPI PHP Class


Code Block
languagephp
linenumberstrue
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Get a list of boxes for user@example.com.
$get_mail_subdir = $cpanel->api2(
    'Email', 'browseboxes', 
    array(
        'account'          => 'user@example.com', 
    ) 
);

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink

 


Expand
titleLiveAPI Perl Module


Code Block
languageperl
linenumberstrue
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Get a list of boxes for user@example.com.
my $get_mail_subdir = $cpliveapi->api2(
    'Email', 'browseboxes',
    { 
        'account'          => 'user@example.com', 
    }
);

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink

 


Expand
titlecPanel Tag System (deprecated)

Include Page
LIB:_cPanelAPI2cPanelTagsWarning
LIB:_cPanelAPI2cPanelTagsWarning


Expand
titleCommand Line


Code Block
languagebash
cpapi2 --user=username Email browseboxes account=user%40example.com dir=maildir showdotfiles=0


Note
titleNote:

For more information and additional output options, read our Guide to cPanel API 2 documentation or run the cpapi2 --help command.  



Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
{
  "cpanelresult": {
    "apiversion": 2,
    "func": "browseboxes",
    "data": [
      {
        "mtime": 1413398866,
        "isleaf": 0,
        "file": "archive",
        "path": "/home/example/mail",
        "depth": 2,
        "relpath": "/archive",
        "ismailbox": 0,
        "fullpath": "/home/example/mail/archive",
        "type": "dir"
      },
      {
        "mtime": 1412787616,
        "isleaf": 0,
        "file": "example.tld",
        "path": "/home/example/mail",
        "depth": 2,
        "relpath": "/example.com",
        "ismailbox": 0,
        "fullpath": "/home/example/mail/example.com",
        "type": "dir"
      }
    ],
    "event": {
      "result": 1
    },
    "module": "Email"
  }
}


Include Page
LIB:_cPanelAPIShellNote
LIB:_cPanelAPIShellNote


Parameters

Note
titleNote:

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


ParameterTypeDescriptionPossible valuesExample
accountstring

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

If you do not include this parameter, the function returns data for all of the cPanel account's email addresses.

A valid email address on the cPanel account.

user@example.com
dirstring

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

If you do not include this parameter, the function returns data for all directories.

A valid directory on the cPanel account.

Note
titleNote:

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


maildir
showdotfilesBoolean

Whether to include hidden files and directories.

This value defaults to 0.

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

Returns

ReturnTypeDescriptionPossible valuesExample
mtimestringThe item's modification time.A time in Unix time format.
1413398866
isleafBooleanWhether the item is a file or a directory.
  • 1 — File.
  • 0 — Directory.
0
filestringThe item's base name.A valid file or directory name.archive
pathstringThe item's directory's path.The item's directory's absolute path./home/example/mail
depthintegerThe directory depth of the item's path.A positive integer.2
relpathstringThe item's relative path.The item's relative path, from the mail directory./archive
ismailboxBooleanWhether the item is a mailbox.
  • 1 — Mailbox.
  • 0 — Not a mailbox.
0
fullpathstringThe item's full path.The item's absolute path./home/example/mail/archive
typestringThe item type.
  • dir — The item is a directory.
  • file — The item is a file.
dir
reasonstring

A reason for failure.

Note
titleNote:

This function only returns a reason value if it failed. 


A string that describes the error.

This is an error message.
resultBoolean

Whether the function succeeded.

  • 1 — The function succeeded.
  • 0 — The function failed.
1