[Dovecot] getting rid of old spam from +spam Maildir ?

Robert Schetterer robert at schetterer.org
Mon Aug 6 09:30:00 EEST 2012


Am 06.08.2012 00:47, schrieb Voytek Eymont:
> 
> On Mon, August 6, 2012 2:23 am, Charles Marcus wrote:
> 
>> The 'date.saved:' is the date/time that the message was moved into that
>> folder.
>>
>> The clock for these messages is based on the time it was moved into that
>> folder, NOT the date/time the message was received in the message header.
>> Maybe this is what is confusing you?
> 
>> So, if you have issue the command to remove messages older than 7 days,
>> that would be 7 days *since they were moved into the folder*.
> 
> Charles,
> 
> thanks
> 
> these are a user+spam spam basket, the actual messages are either in 'new'
> or 'cur', depending if a particular user logged to 'spam' basket or not
> 
> does that mean that say 7 days would clear new messages after 7 days, and,
> any message that is not 'new' after 7 more days, assuming I run the
> command daily ?
> 
> all I want is an auto way to clear +spam baskets after x days
> 
> 

an ugly workaround maybe is ,thing like this, if using maidir

v1.0 cronjob equivalent

For Dovecot v1.0, this can be accomplished by running a daily shell script:

# delete 30 day old mails
find /var/virtualmail/ -regex
'.*/\.\(Trash\|Junk\)\(/.*\)?\/\(cur\|new\)/.*' -type f  -ctime +30  -delete
# or -exec rm '{}' \; instead of -delete

Using ctime means that messages are deleted 30 days after they've been
moved to Trash. If mtime was used instead, it would mean the message is
deleted 30 days after its original creation, which could be immediately.


but i recommend expire plugin, also Timos advices should work for sure

-- 
Best Regards
MfG Robert Schetterer


More information about the dovecot mailing list