1. Home
  2. Knowledge Base
  3. GMS
  4. How can I empty the trash mailbox for my users?

How can I empty the trash mailbox for my users?

Question

Many of my users are not emptying their trash mailbox when they log out of GMS Webmail. I would like to be able to force the emptying of their trash mailbox.

Answer

The following script will run through all users on your mail system deleting the trash mailbox for each of them in turn. Simply save the script as an mml file in the gordanomml directory and call it directly from your browser. For example, if you save it as deletetrash.mml then you would call http://your_server:8000/deletetrash.mml.

<html>
<body>
<p>
<#
log(log_stats,   "Starting Trash check");

domains = DomainNames;
numDomains = LSLength ( domains );

for (d=1; d<=numDomains; d=d+1)
{
domain = LSElement(domains,   d);

log(log_stats, "Checking domain ", d);

users = #domain#usernames;

while (users != "")
{
LSPopElement (users, user, ":");

log(log_stats, "Checking user ", user);
ud = domain & "\" & user;

trashName = #ud#WebMailTrashMailboxName;
basefilename = #ud#trashName;
if (basefilename == "")
{
basefilename = "Trash";
}

filename = ud & "\" & basefilename & ".mbx";

log(log_stats, "Checking file ", filename);

if (ExistFile(filename))
{
log(log_stats, "Deleting file ", filename);
DelFile(filename);
}

filename = ud & "\" & basefilename & ".idx";

log(log_stats, "Checking file ", filename);

if (ExistFile(filename))
{
log(log_stats, "Deleting file ", filename);
DelFile(filename);
}
}
}

log(log_stats, "Finished Trash check");
#>
</body>
</html>

Keywords:trash, empty, mailbox, mml, script

Was this article helpful?

Related Articles

Contents

Need Support?

Can't find the answer you're looking for?
Contact Support