blob: 6fda148b204423a8dfa6fd10ae2008854c912e2c (
plain) (
blame)
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
|
#!/bin/bash
# Extract relevant information from new emails from the specified
# account. Can be useful for notifications.
for i in $(find $1 -path '*/INBOX*?new/*'); do
awk '
BEGIN {
subject = "Subject: <empty>"
}
/^[^ \t]/ {
from_block = 0
}
/^[ \t]+/ && from_block {
sub(/^[ \t]+/, "")
sub(/=\?.*\?=/, "")
from = from $0
}
/^Date:/ {
date = $0
}
/^From:/ {
sub(/=\?.*\?=/, "")
from = $0
from_block = 1
}
/^Subject:/ {
subject = $0
}
END {
print " "
print date
print from
print subject
}
' "$i"
done
|