#!/usr/bin/perl

print "Content-Type: Text/HTML\n\n";

use CGI ':standard';
use Vpanel 1.00;
require $header;
require $accountinfo;
$domainname = find_domain ($mainuser);
$delete_mailbox = param ('mailbox');

# Define the tab which appears to the front
$tab_section = $tabnum_email;

# Output the content associated with this tab
print "<body class=section-$tab_section>";

# display tabs
require $tabdisplay;

print_header ("Emptying the mailbox $delete_mailbox for $domainname");

$ret = php_request ("setFlushInbox", "scope=user:$delete_mailbox\@$domainname");
# TODO: report failures?
#open (EMPTY, ">>$emptymailboxfile") || file_error($emptymailboxfile);
#print EMPTY "$delete_mailbox,$domainname\n";
#close (EMPTY);

print "Thank you for your request to empty the mailbox of the user $delete_mailbox of all emails.";

if ( $delete_mailbox =~ "^spam" )
{
	print "  This will have the effect of deleting the contents of your spam trap.";
}
show_time_to_change();

require $footer;
