- Created by Documentation, last modified on Oct 08, 2018
cPanel Tags
(deprecated)
Backups:: listfullbackups
BoxTrapper:: accountmanagelist
Branding:: addbrandingobj
Branding:: applist
Branding:: brandingeditor
Branding:: createpkg
Branding:: cssmerge
Branding:: delbrandingobj
Branding:: delpkg
Branding:: gensprites
Branding:: getbrandingpkg
Branding:: getbrandingpkgstatus
Branding:: getdefaultbrandingpkg
Branding:: installbrandingpkgs
Branding:: installimages
Branding:: killimgs
Branding:: listimgtypes
Branding:: listobjecttypes
Branding:: preloadconf
Branding:: resetall
Branding:: resetcss
Branding:: resethtml
Branding:: resolve_file
Branding:: resolvelocalcss
Branding:: savelocalcss
Branding:: setbrandingpkgstatus
Branding:: showpkgs
Branding:: spritelist
CSVImport:: columnchoices
CSVImport:: configimport
CSVImport:: data
CSVImport:: fetchimportdata
CSVImport:: isenabled
CSVImport:: loaddata
CSVImport:: processdata
CSVImport:: sendcontact
CSVImport:: uploadimport
Contactus:: isenabled
Contactus:: sendcontact
CustInfo:: contactemails
CustInfo:: contactprefs
CustInfo:: displaycontactinfo
CustInfo:: savecontactinfo
DenyIp:: listdenyips
DiskCounter:: disk_counter
DiskUsage:: buildcache
DiskUsage:: clearcache
DiskUsage:: fetch_raw_disk_usage
DiskUsage:: fetchdiskusage
DiskUsage:: fetchdiskusagewithextras
DnsLookup:: name2ip
DomainLookup:: countbaseddomains
DomainLookup:: getbasedomains
DomainLookup:: getdocroot
DomainLookup:: getdocroots
DomainLookup:: getmaindomain
Email:: accountname
Email:: adddomainforward
Email:: addforward
Email:: addmx
Email:: addpop
Email:: browseboxes
Email:: changemx
Email:: checkmaindiscard
Email:: clearpopcache
Email:: deletefilter
Email:: delforward
Email:: delmx
Email:: delpop
Email:: disablefilter
Email:: editquota
Email:: enablefilter
Email:: fetchautoresponder
Email:: fetchcharmaps
Email:: filteractions
Email:: filterlist
Email:: filtername
Email:: filterrules
Email:: get_archiving_configuration
Email:: get_archiving_default_configuration
Email:: get_archiving_types
Email:: get_default_email_quota
Email:: get_email_signing
Email:: get_max_email_quota
Email:: getabsbrowsedir
Email:: getalwaysaccept
Email:: getdiskusage
Email:: getmxcheck
Email:: has_delegated_mailman_lists
Email:: list_system_filter_info
Email:: listaliasbackups
Email:: listautoresponders
Email:: listdefaultaddresses
Email:: listdomainforwards
Email:: listfilterbackups
Email:: listfilters
Email:: listforwards
Email:: listlists
Email:: listmaildomains
Email:: listmx
Email:: listmxs
Email:: listpops
Email:: listpopssingle
Email:: listpopswithdisk
Email:: listpopswithimage
Email:: loadfilter
Email:: passwdpop
Email:: reorderfilters
Email:: set_archiving_configuration
Email:: set_archiving_default_configuration
Email:: set_email_signing
Email:: setalwaysaccept
Email:: setdefaultaddress
Email:: setmxcheck
Email:: storefilter
Email:: tracefilter
FSTest:: dirisempty
Fileman:: autocompletedir
Fileman:: fileop
Fileman:: getabsdir
Fileman:: getdir
Fileman:: getdiractions
Fileman:: getdiskinfo
Fileman:: getedittype
Fileman:: getfileactions
Fileman:: getpath
Fileman:: listfiles
Fileman:: mkdir
Fileman:: mkfile
Fileman:: savefile
Fileman:: search
Fileman:: statfiles
Fileman:: uploadfiles
Fileman:: viewfile
ForcePassword:: get_force_password_flags
ForcePassword:: update_force_password_flags
Ftp:: addftp
Ftp:: delftp
Ftp:: listftp
Ftp:: listftpsessions
Ftp:: listftpwithdisk
Ftp:: passwd
Ftp:: setquota
HttpUtils:: getdirindices
ImageManager:: thumbnail
LVEInfo:: getUsage
LangMods:: getarchname
LangMods:: getkey
LangMods:: getprefix
LangMods:: install
LangMods:: langlist
LangMods:: list_available
LangMods:: list_installed
LangMods:: magic_status
LangMods:: pre_run
LangMods:: search
LangMods:: setup
LangMods:: uninstall
LangMods:: update
LeechProtect:: setup
Locale:: get_encoding
Locale:: get_html_dir_attr
Locale:: get_locale_name
Locale:: get_user_locale
Locale:: get_user_locale_name
Locale:: numf
Logaholic:: adduser
Logaholic:: adduserprofile
Logaholic:: deleteuser
Logaholic:: deleteuserprofile
Logaholic:: edituser
Logaholic:: fetchuser
Logaholic:: listuserprofiles
Logaholic:: logaholiclink
Logaholic:: processstats
Mime:: list_hotlinks
Mime:: listhandlers
Mime:: listmime
Mime:: listredirects
Mime:: redirectname
Mime:: redirecturlname
MysqlFE:: authorizehost
MysqlFE:: changedbuserpassword
MysqlFE:: createdb
MysqlFE:: createdbuser
MysqlFE:: dbuserexists
MysqlFE:: deauthorizehost
MysqlFE:: deletedb
MysqlFE:: deletedbuser
MysqlFE:: getalldbsinfo
MysqlFE:: getalldbusersanddbs
MysqlFE:: getdbuserprivileges
MysqlFE:: getdbusers
MysqlFE:: gethosts
MysqlFE:: getmysqlprivileges
MysqlFE:: getmysqlserverprivileges
MysqlFE:: has_mycnf_for_cpuser
MysqlFE:: listdbs
MysqlFE:: listdbsbackup
MysqlFE:: listhosts
MysqlFE:: listusers
MysqlFE:: listusersindb
MysqlFE:: revokedbuserprivileges
MysqlFE:: setdbuserprivileges
MysqlFE:: userdbprivs
MysqlOptimizer:: fetch_slow_queries
Net:: dnszone
Net:: traceroute
PHPINI:: getalloptions
PHPINI:: getoptions
Passwd:: change_password
Passwd:: set_digest_auth
PasswdStrength:: appstrengths
PasswdStrength:: get_password_strength
PasswdStrength:: get_required_strength
Rand:: getranddata
Resellers:: get_sub_accounts
RoR:: addapp
RoR:: changeapp
RoR:: importrails
RoR:: listapps
RoR:: listrewrites
RoR:: needsimport
RoR:: removeapp
RoR:: removerewrite
RoR:: restartapp
RoR:: setuprewrite
RoR:: softrestartapp
RoR:: startapp
RoR:: stopapp
SetLang:: setlocale
SourceIPCheck:: addip
SourceIPCheck:: delip
SourceIPCheck:: getaccount
SourceIPCheck:: listips
SourceIPCheck:: loadsecquestions
SourceIPCheck:: resetsecquestions
SourceIPCheck:: samplequestions
SourceIPCheck:: savesecquestions
SPFUI:: available
SPFUI:: count_settings
SPFUI:: entries_complete
SPFUI:: get_raw_record
SPFUI:: getmainserverip
SPFUI:: install
SPFUI:: installed
SPFUI:: list_settings
SPFUI:: load_current_values
SPFUI:: uninstall
SSH:: authkey
SSH:: converttoppk
SSH:: delkey
SSH:: fetchkey
SSH:: genkey
SSH:: genkey_legacy
SSH:: importkey
SSH:: listkeys
SSL:: fetchcabundle
SSL:: fetchinfo
SSL:: gencrt
SSL:: gencsr
SSL:: genkey
SSL:: getcnname
SSL:: installssl
SSL:: listcrts
SSL:: listcsrs
SSL:: listkeys
SSL:: listsslitems
SSL:: uploadcrt
SSL:: uploadkey
SSLInfo:: fetchinfo
StatCache:: clearcache
Stats:: getmonthlybandwidth
Stats:: getmonthlydomainbandwidth
Stats:: getthismonthsbwusage
Stats:: lastapachehits
Stats:: lastvisitors
Stats:: listanalog
Stats:: listawstats
Stats:: listlastvisitors
Stats:: listrawlogs
Stats:: listurchin
Stats:: listwebalizer
SubDomain:: addsubdomain
SubDomain:: changedocroot
SubDomain:: delsubdomain
SubDomain:: getreservedsubdomains
SubDomain:: listsubdomains
SubDomain:: validregex
Themes:: apply_new_theme
Themes:: does_cpanel_theme_exist
Themes:: get_available_themes
Themes:: get_themes_list
Themes:: restore_saved_theme
UserHttpUtils:: getdirindices
WebDisk:: addwebdisk
WebDisk:: delwebdisk
WebDisk:: hasdigest
WebDisk:: listwebdisks
WebDisk:: passwdwebdisk
WebDisk:: set_digest_auth
WebDisk:: set_homedir
WebDisk:: set_perms
WebDisk:: setstatus
WebmailApps:: listwebmailapps
ZoneEdit:: add_zone_record
ZoneEdit:: edit_zone_record
ZoneEdit:: fetch_cpanel_generated_domains
ZoneEdit:: fetchzone
ZoneEdit:: fetchzone_records
ZoneEdit:: fetchzones
ZoneEdit:: get_zone_record
ZoneEdit:: remove_zone_record
ZoneEdit:: resetzone
Description
This function retrieves an email account's username.
Warning:
We strongly recommend that you use the following UAPI function instead of this function:
Email::account_name
— This function returns an email account's username or address.
Important:
MailReceive
role, the system disables this function. For more information, read our How to Use Server Profiles documentation.Examples
https://hostname.example.com:2087/cpsess##########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Email&cpanel_jsonapi_func=accountname&account="user@example.com"
$cpanel = new CPANEL(); // Connect to cPanel - only do this once. // Retrieve the email account username for user@example.com $get_email_username = $cpanel->api2( 'Email', 'accountname', array( 'account' => 'user@example.com', ) ); // Retrieve the email address for the email username "user" $get_email_username = $cpanel->api2( 'Email', 'accountname', array( 'account' => 'user', ) ); // Return "All Mail On Your Account" $get_email_username = $cpanel->api2( 'Email', 'accountname', array( 'display' => '', ) );
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once. # Retrieve the email account username for user@example.com my $get_email_username = $cpliveapi->api2( 'Email', 'accountname', { 'account' => 'user@example.com', } ); # Retrieve the email address for the email username "user" my $get_email_username = $cpliveapi->api2( 'Email', 'accountname', { 'account' => 'user', } ); # Return "All Mail On Your Account" my $get_email_username = $cpliveapi->api2( 'Email', 'accountname', { 'display' => '', } );
Warnings:
- In cPanel & WHM version 11.30 and later, cPanel tags are deprecated. We strongly recommend that you only use the LiveAPI system to call the cPanel APIs. Examples are only present in order to help developers move from the old cPanel tag system to our LiveAPI.
- cPanel API 2 calls that use cPanel tags vary in code syntax and in their output.
- For more information, read our Deprecated cPanel Tag Usage documentation.
cpapi2 --user=username Email accountname account=user%40example.com
Note:
For more information and additional output options, read our Guide to cPanel API 2 documentation or run the cpapi2 --help
command.
{ "cpanelresult": { "apiversion": 2, "func": "accountname", "data": [ { "account": "user" } ], "event": { "result": 1 }, "module": "Email" } }
Note:
Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.
Parameters
Note:
You must use either the account
or display
input parameter when you call this function.
Parameter | Type | Description | Possible values | Example |
---|---|---|---|---|
account | string | The email username or email address, to return the email address or username, respectively. |
| user@example.com |
display | string | Use this parameter without the account parameter to return the string All Mail On Your Account . | A blank value. | '' |
Returns
Return | Type | Description | Possible values | Example |
---|---|---|---|---|
account | string | The email account username, the email address, or the string The input parameter that you use and its value determines the |
| user |
reason | string | A reason for failure. Note: This function only returns a | A string that describes the error. | This is an error message. |
result | Boolean | Whether the function succeeded. |
| 1
|
Function information
Module:
Email
API Version:
Available in:
cPanel 11+
Methods:
GET, POST
Required Parameters:
account
or display
Return Formats:
JSON, XML
Notes:
- XML output is only available if you call this function from the WHM API.
- cPanel & WHM version 66 deprecated XML output.
Legacy Equivalents:
(none)
About this module
The Email
module modifies cPanel email account settings.
About cPanel API 2
cPanel API 2 accesses and modifies data for cPanel accounts.
Notes:
- These functions may require a feature list. To view the available feature lists on a cPanel server, view WHM's Feature Manager interface.
- Unless you call this API via the WHM API, you must use the appropriate cPanel ports (
2082
or2083
). You can also call some functions via cPanel's Webmail ports (2095
or2096
).
Find a function
Related functions
-
Page:cPanel API 2 Functions - Email::delpop — This function deletes an email account.
-
Page:cPanel API 2 Functions - Email::editquota — This function modifies an email account's disk quota.
-
Page:cPanel API 2 Functions - Email::passwdpop — This function modifies an email account's password.
-
Page:cPanel API 2 Functions - Email::listdefaultaddresses — This function retrieves the domain's default address and its rules.
-
Page:cPanel API 2 Functions - Email::listaliasbackups — This function retrieves a list of the account's domains that use aliases and custom default addresses.