summaryrefslogtreecommitdiff
path: root/dotfiles/Mail/.notmuch/hooks/pre-new
blob: 151dc8526e4d45f62112d147975b2fd3ef1c1375 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh

# Delete mail
#notmuch search --output=files tag:deleted | xargs -rl rm

# Move marked spam to spam folder
notmuch search --output=files path:FSF/** AND NOT folder:FSF/INBOX.Spam \
        AND tag:spam | xargs -I '{}' mv '{}' ~/Mail/FSF/INBOX.Spam/cur

# Delete spam after one week
notmuch tag +deleted -- tag:spam AND date:..one_week

# Delete commits after one month
notmuch tag +deleted -- tag:commits AND date:..one_month

# Move mail from archive to inbox
notmuch search --output=files --duplicate=1 NOT tag:archive AND \
        folder:WSU/Archive \
    | xargs -I '{}' mv '{}' ~/Mail/WSU/INBOX/cur

# Move mail from inbox to archive
notmuch search --output=files --duplicate=1 tag:archive AND \
        NOT folder:WSU/Archive \
    | xargs -I '{}' mv '{}' ~/Mail/WSU/Archive/cur

exit 0