Child pages
  • UAPI Functions - Mailboxes::expunge_messages_for_mailbox_guid
Skip to end of metadata
Go to start of metadata

 

Description

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

Examples


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


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Mark the selected mailbox's messages as deleted.
$Mailboxes_expunge_mailbox_messages = $cpanel->uapi(
    'Mailboxes', 'expunge_messages_for_mailbox_guid'
);


Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Mark the selected mailbox's messages as deleted.
my $Mailboxes_expunge_mailbox_messages = $cpliveapi->uapi(
    'Mailboxes', 'expunge_messages_for_mailbox_guid',
);


Note:

For more information, read our Guide to the LiveAPI System.

 cPanel Template Toolkit
<!-- Erase email messages. -->
[% data = execute( 'Mailboxes', 'expunge_messages_for_mailbox_guid' ); %]
[% FOREACH q = data %]
     <p>
         [% q %]
     </p>
[% END %]


Note:

For more information, read our Guide to Template Toolkit documentation. 

 Command Line
uapi --user=username Mailboxes expunge_mailbox_messages account=example mailbox_guid=2550860f0c58d158c92a000044f0d230 query=savedbefore52w


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • We introduced this functionality in cPanel & WHM version 56.

 Output (JSON)
{  
   "metadata":{  
      "reason":"OK",
      "command":"expunge_mailbox_messages",
      "version":1,
      "result":1
   },
   "data":{  
   }
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

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.

Note:

To find the mailbox GUID, use the UAPI - 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.