> Hello,
> 
>       Sorry if this isn't the place to ask, but I've looked 
> all over and haven't managed to find a clear solution. I'm 
> looking for a way to have items that have been in the user's 
> .Trash folder for a certain period of time (lets say 30 days 
> or older) removed automatically. I thought there must be 
> built-in functionality for this, or a script someone has come 
> up with to manage this sort of thing. I've see a squirrelmail 
> plugin that does it based on number of logins or every x 
> number of days, but it empties the whole trash and doesn't 
> check each message's age individually.
> 
> Any help would be greatly appreciated.
> 
> Thanks,
> 
> Matt Rauch

Just to update everyone. I did find a way to accomplish this even though we
are using the vpopmail auth. I found this script online and modified it to
fit my login info:
----------------------------------------------------------
#!/usr/local/bin/bash
# MySQL details

HOST="localhost";
USER="vpopmail";
PWD="vpopmail passwd";

# Output sql to a file that we want to run
echo "USE vpopmail; select concat(pw_name,'@',pw_domain) as username from
vpopmail;" > /tmp/query.sql;

# Run the query and get the results
results=`mysql -h $HOST -u $USER -p$PWD -N < /tmp/query.sql`;

# Loop through each row
for row in $results
do
/usr/local/bin/doveadm expunge -u $row mailbox Trash savedbefore 52w
done

---------------------------------------------------------

Maybe this can help someone else who is in the same boat.

Matt Rauch


!DSPAM:50a0f90033991110759285!

Reply via email to