Description


This function marks the selected mail messages as deleted.


Examples




https://hostname.example.com:2083/cpsess##########/execute/Mailboxes/expunge_mailbox_messages?account=example&mailbox=INBOX.user@example_com&query=savedbefore%2052w



$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Mark the selected mail messages as deleted.
$Mailboxes_get_mailbox_status = $cpanel->uapi(
    'Mailboxes', 'expunge_mailbox_messages'
);



my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Mark the selected mail messages as deleted.
my $Mailboxes_get_mailbox_status = $cpliveapi->uapi(
    'Mailboxes', 'expunge_mailbox_messages',
);



<!-- Mark the selected mail messages as deleted. -->
[% data = execute( 'Mailboxes', 'expunge_mailbox_messages' ); %]
[% FOREACH q = data %]
     <p>
         [% q %]
     </p>
[% END %]



uapi --user=username Mailboxes expunge_mailbox_messages account=example mailbox=INBOX.user@example_com query="savedbefore 52w"



 
{
  "messages": null,
  "errors": null,
  "status": 1,
  "metadata": {
  },
  "data":null
}



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 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 to operate on.

A valid mailbox folder on the server that the user owns that uses the following format:

The mailbox folder name, a period (.), and the address with and underscore (_) instead of a period (.).


INBOX.user@example_com

querystring

Required

The Dovecot® query to execute.

  • The query parameter prevents accidental removal of all messages in the mailbox
  • For more information, read Dovecot's Search Query documentation.


 A valid Dovecot search query. savedbefore 52w

Returns

This function only returns metadata.