UAPI Functions - Email::list_mail_domains

Description

This function lists the account's mail domains.

Examples


 cPanel or Webmail Session URL

https://hostname.example.com:2083/cpsess##########/execute/Email/list_mail_domains?select=example.com

 LiveAPI PHP Class

$cpanel new CPANEL(); // Connect to cPanel - only do this once.
  
// List the account's mail domains.
$get_mail_domains $cpanel->uapi(
    'Email''list_mail_domains',
    array(
        'select'        => 'example.com',
         )
);

 LiveAPI Perl Module

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
  
# List the account's mail domains.
my $get_mail_domains $cpliveapi->uapi(
    'Email''list_mail_domains',
    {
        'select'        => 'example.com',
    }
);

 cPanel Template Toolkit

<!-- List the account's mail domains. -->
[% execute('Email', 'list_mail_domains', { 'select' => 'example.com' } ) %]

 Command Line

uapi --user=username Email list_mail_domains select=example.com

 

Notes:

  • You must URI-encode values.
  • username represents your account-level username.

 Output (JSON)

   "messages":null,
   "errors":null,
   "status":1,
   "metadata":{ 
      "transformed":1
   },
   "data":[ 
      
         "domain":"example.com",
         "select":1
      },
      
         "domain":"addondomain.com"
      },
      
         "domain":"subdomain.example.com"
      },
      
         "domain":"seconddomain.com"
      },
      
         "domain":"seconddomain.example.com"
      }
   ]
}

 

Note:

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

 

Parameters

Parameter

Type

Description

Possible values

Example

select

string

 The name of the domain that the function returns with theselect output parameter.

If you do not use this parameter, the function will not return the select parameter with any domains.

A valid domain on the account.

 example.com 

add_www

Boolean

Whether to list www.addresses.

This parameter defaults to 0.

  • 1 — List www. addresses.
  • 0 — Do not list www. addresses.

For example, if you specify 1, the function's output would include both example.com andwww.example.com. If you specify 0, the output would include only example.com.

1

 include_wildcard 

 Boolean 

Whether to list wildcard addresses.

This parameter defaults to 0.

  • 1 — List wildcard addresses.
  • 0 — Do not list wildcard addresses.

For example, if you specify 1, the function's output would include both example.com and*.example.com. If you specify 0, the output would include only example.com.

1

 

Returns

Note:

This function always returns the account's main domain first. 

 

Return

Type

Description

Possible values

Example

 domain 

string

The domain name.

The name of a main domain, addon domain, or subdomain on the cPanel account.

 example.com 

select

 Boolean 

A Boolean value that marks the domain that you specified in the select input parameter.

 The function only returns this value if you included the select parameter when you called the function. 

1 is the only possible value.

Note:

 Because this value only appears if you included the select input parameter, The value always defaults to 1. 

1

 

  • 54 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....