~ben/bin

ref: 95a3cb30f61e90fe00cd859f10e323bbc3e62e99 bin/eml -rwxr-xr-x 799 bytes View raw
95a3cb30Ben Sima cleanup textract and rdr 1 year, 2 months ago
                                                                                
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
#
# A wrapper for all email tasks. Examples:

function count {
    count=$(notmuch count tag:inbox and tag:unread)
    if [[ $count > 0 ]]; then
        notify-send "New mail" "$count messages"
    else
        notify-send "No new mail"
    fi
    echo $count
}

function tag {
    afew -tnv
    afew -mnv
    echo "re-tagging inbox.."
    afew -t tag:inbox
}

case "$1" in
    "in") mbsync --all
        ;;
    "out") msmtp-queue -r
        ;;
    "new") notmuch new
        ;;
    "tag") tag
        ;;
    "all")
        notify-send "Starting email sync"
        msmtp-queue -r
        mbsync --all
        notmuch new
        tag
        count
        ;;
    "-h"|"--help")
        echo "usage: $0 [in|out|new|tag|all]"
        exit 1
        ;;
    *) count
        ;;
esac