Deleting Spam From sup Maildirs

A quirk of the sup email client is that it doesn’t sync back changes like deletes to mail sources. “Deleted” messages are only flagged and hidden from the user.

After a few hundred thousand spam messages, sup slows down a bit and I have to actually delete it. I forget how every time, so this is mostly a note to myself in the hopes that someone else needs to delete mail from maildirs managed by sup.

First, type L to search for spam and delete the spam. Use T to tag all messages and =d to delete all tagged messages, perhaps after using \ to filter your view to obvious spam (and use !! to load everything that matches the query). Then quit sup and run:

` # update the email filenames in the maildir so deleted (“trashed”) messages get the “T” flag $ sup-sync-back-maildir -nu # get rid of them $ mkdir /tmp/deleted-spam $ find ~/path/to/mail -type f -regex “.,.T” -exec mv {} /tmp/deleted-spam # sync sup to know they’re gone $ sup-sync –all-sources -o `{lang=”bash”}

After checking that everything’s fine, delete /tmp/deleted-spam (or ignore it; the contents of /tmp are wiped every reboot).