On Mon, Feb 15, 2021 at 04:21:11PM +0000, Chris Green wrote:

mails in my junk catching directories, is it OK/safe to do it like this?

   20 02 * * * find /home/chris/mail/Ju/*/cur -type f -mtime +7 -exec rm {} \;
   30 02 * * * find /home/chris/mail/Ju/*/new -type f -mtime +7 -exec rm {} \;

Are those junk catching directories where you place email to be deleted temporarily, so that you don't through them right away? Lie a Trash maildir of sorts? I use trash locally and Trash remotely (at the IMAP server) to serve that function.

The first thing I do when processing email is making an automatic copy in the IMAP server of every email in the IMAP server through this rule:

  bak = ama["INBOX"]:is_new()
  bak : copy_messages(ama["bak"])

So, in case something goes wrong, I can always go back to the original mail. My backup maildir (bak) gets deleted after 180 days, and my Trash maildir (IMAP) gets deleted after 30 days through this imapfilter rule:

  old = ama.bak:is_older(180)
      + ama.Trash:is_older(30)
  old : delete_messages()

Now, in some boxes I delete email but don't synchronize back the local trash maildir to the IMAP server (sometimes I do, but not always. And then to prevent deleted email to accumulate in local maildirs I delete it though a couple of cron jobs very much like yours:

@daily   /usr/bin/nice find ~/mail/trash/cur/ -type f -ctime +7 -delete
@daily   /usr/bin/nice find ~/mail/trash/new/ -type f -ctime +7 -delete

I believe Mutt has no problems at all with mailfolders beeying manipulated externally by other programs (in fact, I fetch my email with mbsync, sort email and modify subjects and such with imapfilter, etc., I think it's just fine deleting old junk using the find jobs as we both do. (Unless I'm missing something.)

Cheers,
Ángel

Reply via email to