mutt-wizard

fork of Luke Smiths mutt-wizard
git clone git://git.jakekoroman.com/mutt-wizard
Log | Files | Refs | README | LICENSE

commit 7955090f9f5ffc8e95070924a56f492ec6bbd0d7
parent e50d51d3e56c7531cf321b7a0ed7276ad14bb90d
Author: luukvbaal <31730729+luukvbaal@users.noreply.github.com>
Date:   Sat,  1 Jun 2019 20:34:09 +0200

fix forwarded emails and posix whitespace regex
Diffstat:
Mbin/mailsync | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/mailsync b/bin/mailsync @@ -28,9 +28,9 @@ syncandnotify() { if [ "$newcount" -gt "0" ]; then notify "$acc" "$newcount" & for file in $new; do - # Extract subject and sender from mail. - from=$(grep "^From: " "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if ($NF>=3)$NF=""; print $0 }' | tr -d "\"\'\<\>" | sed 's/^ \(.*\) $/\1/') - subject=$(sed -n '/^Subject: /,/^.*:/p' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | head -n-1) + # Extract subject and sender from mail. + from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//') + subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: /' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//') notify-send "📧$from:" "$subject" & done fi