Description

This function marks the selected mailbox's messages as deleted.


Examples




https://hostname.example.com:2083/cpsess##########/execute/Mailboxes/expunge_messages_for_mailbox_guid?account=example&mailbox_guid=2550860f0c58d158c92a000044f0d230&query=savedbefore%2052w



$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Mark the selected mailbox's messages as deleted.
$Mailboxes_expunge_messages_for_mailbox_guid = $cpanel->uapi(
    'Mailboxes', 'expunge_messages_for_mailbox_guid',
    array (
        'account'      => 'user@example.com',
        'mailbox_guid' => '2550860f0c58d158c92a000044f0d230',
        'query'        => 'savedbefore 52w'
    )
);



my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Mark the selected mailbox's messages as deleted.
my $Mailboxes_expunge_messages_for_mailbox_guid = $cpliveapi->uapi(
    'Mailboxes', 'expunge_messages_for_mailbox_guid',
    {
        'account'      => 'user@example.com',
        'mailbox_guid' => '2550860f0c58d158c92a000044f0d230',
        'query'        => 'savedbefore 52w'
    }
);



<!-- Mark the selected mailbox's messages as deleted. -->
[% data = execute( 'Mailboxes', 'expunge_messages_for_mailbox_guid' { 'account' => 'user@example.com', 'mailbox_guid' => '2550860f0c58d158c92a000044f0d230', 'query' => 'savedbefore 52w' } ); %]



uapi --user=username Mailboxes expunge_messages_for_mailbox_guid account=example mailbox_guid=2550860f0c58d158c92a000044f0d230 query="savedbefore 52w"



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



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.

     

  • user@example.com
  • example
mailbox_guidstring

Required

The mailbox's globally unique identifier (GUID).

A valid mailbox GUID on the account.

To find the mailbox GUID, use UAPI's Mailboxes::get_mailbox_status_list function.


2550860f0c58d158c92a000044f0d230
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.