delete/archive old mail

F. sottilette at
Tue Oct 14 11:17:43 UTC 2014

>>>> Hi everybody,
>>>>         I store user's mail in the old mbox format.
>>>> I have many scripts to manage users that works fine with mbox.
>>>> I use the very old script to delete mail older than NN
>>>> days for selected users (nightly cron job). Still works fine with my
>>>> CentOS dovecot-2.0.16.
>>>> Now I want move the mail to a sort of archive folder instead of simply
>>>> deleting it from the inbox for some users.
>>>> Is there a similar script or some simple triks?
>>>> Thanks, F.
>>> perhaps you will find some ideas here
>>> ...
>>> #/bin/bash
>>> YEAR=`/bin/date +%Y`
>>> /usr/bin/doveadm expunge -d -u * mailbox
>>> user-backup\*$YEAR*\* savedbefore 10d
>>> ...
>> Thanks for replay.
>> My German is really poor, but from a quick look of the example above and
>> man doveadm[-expunge], seems that it can be used to replace the old
>> (I need to study the right syntax ...)
>> But still there is the move/archive old mail activity not solved.
> i use the bc feature of postfix to move a copy of all mail per
> maildomain into a backup maildomain archive folder, as this is done via lmtp
> i am able to sort mails via sieve per user and date folder, depending
> on how you like to setup you may use imap acl to give seen rights to the
> orig user, so the may restore their own mail whenever they want and/or
> their domain postmaster can do it for them.
> But thats only one chance you can do it, you have to decide what fits
> best to your needs.
>> doveadm-altmove seems interesting, but in the man page it is reported
>> only work with dbox (dbox-only), and my inboxes are in mbox format.
>> Any other advice?

Sorry for the replay to sender instead of the list.

As I originally wrote, my need is script or a command like the old that parse a local mbox folder and move/copy mail older 
than NN days to another local mbox folder.
Probably for a Perl programmer is only matter of modify this script or 
something similar. 
I searched in docs, wiki, ... but not noticied something that can simply 
be inserted in a cron job to do the work.

Only migration tools or complex (for me), library that can be used to 
manipulate folders :-)

Thanks, F.

More information about the dovecot mailing list