From effa100e044de157d1db30978b8fab101e627df8 Mon Sep 17 00:00:00 2001 From: luukvbaal <31730729+luukvbaal@users.noreply.github.com> Date: Sat, 1 Jun 2019 21:56:55 +0200 Subject: [PATCH] fix multiline subject header regression --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index d5be1de..21ebc64 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -30,7 +30,7 @@ syncandnotify() { for file in $new; do # 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:]]*$//') + subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n-1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n') notify-send "📧$from:" "$subject" & done fi