Tom Collins wrote:
On Mar 2, 2010, at 3:31 PM, Trey Nolen wrote:
In the past, we have been using Sqwebmail to remove email from the Trash folder 
periodically (by default 7 days).  Now, we have migrated to a new server using 
the new Vpopmail which no longer supports Sqwebmail.  We have moved to 
SquirrelMail for our main webmail interface. I would still like to be able to 
remove deleted items after 7 days.  I have seen the Proon plugin for 
SquirrelMail, but I believe it is too complex for most users, and it also will 
not let us specify global defaults.   Does anyone out there have a solution 
they are using?

It's a bit of a hack, but here's what I'm doing right now:

#!/usr/bin/perl

$|++;
$days = 60;

@globs = (
        '*/*/Maildir/.Trash*/{cur,new}',
        '?/*/*/Maildir/.Trash*/{cur,new}',
        '*/?/*/Maildir/.Trash*/{cur,new}',
        '?/*/?/*/Maildir/.Trash*/{cur,new}',

        '*/*/Maildir/.Deleted Messages*/{cur,new}',
        '?/*/*/Maildir/.Deleted Messages*/{cur,new}',
        '*/?/*/Maildir/.Deleted Messages*/{cur,new}',
        '?/*/?/*/Maildir/.Deleted Messages*/{cur,new}'
);

$c = 0;

print "Deleting mail in .Trash and .Deleted Messages folders, over $days days 
old.\n";

foreach $path (@globs)
{
        while ($name = glob ('/home/vpopmail/domains/' . $path))
        {
                opendir (D, $name);
                while ($f = readdir(D))
                {
                        # skip non-files
                        next if (! -f "$name/$f");
                        $t = -M "$name/$f";
                        if ($t > $days)
                        {
                                unlink "$name/$f";
                                $c++;
                        }
                }
        }
}

print "Deleted $c messages over $days days old\n";


-Tom



Cool.  I'll give it a try.   Thanks!

Trey Nolen



!DSPAM:4b945f4032711087518585!

Reply via email to