Description

This function removes mail messages from a cPanel account that you select with a query.

Examples




https://hostname.example.com:2087/cpsess##########/json-api/expunge_mailbox_messages?api.version=1&account=example&mailbox=INBOX&query=savedbefore%2052w




https://hostname.example.com:2087/cpsess##########/xml-api/expunge_mailbox_messages?api.version=1&account=example&mailbox=INBOX&query=savedbefore%2052w




whmapi1 expunge_mailbox_messages account=example mailbox=INBOX query="savedbefore%2052w"



{  
   "metadata":{  
      "reason":"OK",
      "command":"expunge_mailbox_messages",
      "version":1,
      "result":1
   },
   "data":{  

   }
}




<result>
    </data>
    <metadata>
        <reason>OK</reason>
        <version>1</version>
        <result>1</result>
        <command>expunge_mailbox_messages</command>
    </metadata>
</result>



Parameters

ParameterTypeDescriptionPossible valuesExample
accountstring

Required

The email account's name.

  • A valid email account that exists on the server.
  • The cPanel user's account name.

    _mainaccount is an alias that represents the cPanel user's mailbox (For example, _mainaccount@example.com represents the example mailbox).


user@example.com

example

_mainaccount@example.com

mailboxstring

Required

The mailbox's name.

A valid mailbox name on the account.

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.


INBOX

querystring

Required

The query to select which messages you wish to remove from the mailbox.

A valid Dovecot® search query

For more information, read Dovecot's Search Query documentation.

savedbefore 52w

Returns

This function only returns metadata.