WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
Request
This function removes mail messages from a cPanel account that you select with a query.
Important:
When you disable the Receive Mail role, the system disables this function.
An email account that exists on the server.
A mailbox name on the account.
Note:
Because you cannot escape wildcard characters such as (*), we recommend that you use functions that use the mailbox_guid parameter instead. For example, the WHM API 1 expunge_messages_for_mailbox_guid function.
A Dovecot search query to select which messages you wish to remove from the mailbox.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/expunge_mailbox_messages
- A server running WHM.
https://whm-server.tld:2087/json-api/expunge_mailbox_messages
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/expunge_mailbox_messages?account=user%40example.com&mailbox=INBOX&query=savedbefore+52w'{ "metadata": { "command": "expunge_mailbox_messages", "reason": "OK", "result": 1, "version": 1 } }
Request
This function removes mail messages from a cPanel account.
Important:
When you disable the Receive Mail role, the system disables this function.
The mailbox's globally unique identifier (GUID).
Note:
To find the mailbox GUID, use the WHM API 1 - get_mailbox_status function.
The Dovecot search query to select which messages you wish to remove from the mailbox. For more information, read Dovecot's Search Query documentation.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/expunge_messages_for_mailbox_guid
- A server running WHM.
https://whm-server.tld:2087/json-api/expunge_messages_for_mailbox_guid
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/expunge_messages_for_mailbox_guid?account=user%40example.com&mailbox_guid=2550860f0c58d158c92a000044f0d230&query=savedbefore+52w'{ "metadata": { "command": "expunge_messages_for_mailbox_guid", "reason": "OK", "result": 1, "version": 1 } }
Request
This function lists the status of a cPanel's mail account's mailboxes.
Important:
When you disable the Receive Mail role, the system disables this function.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/get_mailbox_status
- A server running WHM.
https://whm-server.tld:2087/json-api/get_mailbox_status
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/get_mailbox_status?account=user%40example.com'HTTP Request was successful.
{ "data": { "INBOX": { … }, "INBOX.Drafts": { … }, "INBOX.Sent": { … }, "INBOX.Trash": { … }, "INBOX.angel_face@example_com": { … }, "INBOX.marla_singer@example_com": { … }, "INBOX.narrator@example_com": { … }, "INBOX.robert_paulsen@example_com": { … }, "INBOX.tyler_durden@example_com": { … } }, "metadata": { "command": "get_mailbox_status", "reason": "OK", "result": 1, "version": 1 } }