[Dovecot] Auto-expire messages in a folder
I have a Fedora 5 server running Dovecot (currently 1.0 rc10). The spam filter (amavis) automatically tags email (using plussed addressing) such that messages flagged as spam are sorted into a "spambox" folder by procmail. Seemed like a good idea at the time, but because of some legacy issues with filesystem quota also being in place, combined with most users connecting with POP3 rather than IMAP... spam doesn't stay in their inbox, they don't check their spambox and they are very quickly over quota.
What I would like to do is stick with the "spambox" folder idea, but have any messages in that folder which are older than a certain number of days deleted automatically. Could this be done by Dovecot? If so how would dovecot know to visit all the user's mailboxes to do it... or would it only be able to do so when a user logged in via IMAP (as opposed to POP3)? If not, is anyone aware of a script that I could run in nightly maintenance to do a cleanup pass on all the mailboxes?
I know there are any number of ways that this could be accomplished but I would like to do it as much within my existing framework as possible... sendmail/procmail/amavis on the delivery side, dovecot in the middle, horde/imp for webmail and whatever email client the end users have (likely Outlook/Outlook Express for the most part)... all pretty generic, standard mailbox formats... nothing fancy like data stored in mySQL or anything like that. As everyone encounters, the more parts you change, the more other parts you have to fix to be compatible with the changes :-)
Obviously I would like the solution to also be as feature rich as I can at the same time (might as well wish for it all right :-). Maybe for the sake of the POP3 folks it would also be nice to generate a once-daily email with the names, subjects of the messages in the folder saying "here's what is in your spam folder, please log in to webmail to manage your spam" (and in a perfect world some sort of link to click on which could move the message from the spambox back into the inbox).
Does anyone have any solutions they can share that run within a similar framework to what I have set up?
The thing that I need in the immediate term is to purge the spam folder automatically, the mid-term goal is to evolve that into a sort of spam-processing center/solution for the users.
Thanks for any suggestions!
Cheers,
Mike <<<<<
This does not seem te be a task for Dovecot. I run a daily cronjob, on a FC4 server:
$cat /etc/cron.daily/purge.junk #!/bin/sh
HOURS=$((2 * 24 * 7))
for domain in /var/mail/* do if [ -d "$domain" ] then cd $domain for user in * do if [ -d "$user/Maildir/.Junk" ] then tmpwatch $HOURS $user/Maildir/.Junk/{cur,new} fi done fi done
Mark
-----Oorspronkelijk bericht----- Van: dovecot-bounces@dovecot.org [mailto:dovecot-bounces@dovecot.org] Namens Mike Cisar Verzonden: zondag 5 november 2006 18:52 Aan: dovecot@dovecot.org Onderwerp: [Dovecot] Auto-expire messages in a folder
I have a Fedora 5 server running Dovecot (currently 1.0 rc10). The spam filter (amavis) automatically tags email (using plussed addressing) such that messages flagged as spam are sorted into a "spambox" folder by procmail. Seemed like a good idea at the time, but because of some legacy issues with filesystem quota also being in place, combined with most users connecting with POP3 rather than IMAP... spam doesn't stay in their inbox, they don't check their spambox and they are very quickly over quota.
What I would like to do is stick with the "spambox" folder idea, but have any messages in that folder which are older than a certain number of days deleted automatically. Could this be done by Dovecot? If so how would dovecot know to visit all the user's mailboxes to do it... or would it only be able to do so when a user logged in via IMAP (as opposed to POP3)? If not, is anyone aware of a script that I could run in nightly maintenance to do a cleanup pass on all the mailboxes?
I know there are any number of ways that this could be accomplished but I would like to do it as much within my existing framework as possible... sendmail/procmail/amavis on the delivery side, dovecot in the middle, horde/imp for webmail and whatever email client the end users have (likely Outlook/Outlook Express for the most part)... all pretty generic, standard mailbox formats... nothing fancy like data stored in mySQL or anything like that. As everyone encounters, the more parts you change, the more other parts you have to fix to be compatible with the changes :-)
Obviously I would like the solution to also be as feature rich as I can at the same time (might as well wish for it all right :-). Maybe for the sake of the POP3 folks it would also be nice to generate a once-daily email with the names, subjects of the messages in the folder saying "here's what is in your spam folder, please log in to webmail to manage your spam" (and in a perfect world some sort of link to click on which could move the message from the spambox back into the inbox).
Does anyone have any solutions they can share that run within a similar framework to what I have set up?
The thing that I need in the immediate term is to purge the spam folder automatically, the mid-term goal is to evolve that into a sort of spam-processing center/solution for the users.
Thanks for any suggestions!
Cheers,
Mike <<<<<
On Sun, 2006-11-05 at 10:52 -0700, Mike Cisar wrote:
What I would like to do is stick with the "spambox" folder idea, but have any messages in that folder which are older than a certain number of days deleted automatically.
There's a plugin for this, but it won't come to v1.0, and you probably shouldn't use the CVS HEAD version yet.
If not, is anyone aware of a script that I could run in nightly maintenance to do a cleanup pass on all the mailboxes?
Whatever script you use, it's better to delete by ctime and not mtime.
participants (3)
-
Mark Ruys
-
Mike Cisar
-
Timo Sirainen