mutt-wizard

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit ea8fef34387ca49765a76114e23098296dae2ac1
parent 8cb5f9d2e4b78894f912393c69740d99ee69e505
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Fri, 28 Feb 2025 09:31:28 +0000

Merge pull request #999 from jdujava/fix-multiline-subjects

Fix notifications for mails with multiline subject
Diffstat:
Mbin/mailsync | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/bin/mailsync b/bin/mailsync @@ -70,9 +70,10 @@ syncandnotify() { echo "$newcount new mail(s) for $2." [ -z "$MAILSYNC_MUTE" ] && for file in $new; do - # Extract and decode subject and sender from mail. - subject="$(sed -n "/^Subject:/ s|Subject: *|| p" "$file" | - perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" + # Extract and decode subject and sender from mail. + subject=$(awk '/^Subject: / && ++n == 1,/^.*: / && ++i == 2' "$file" | head -n-1 | + perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | + sed 's/^Subject: //' | tr -d '\n\t') from="$(sed -n "/^From:/ s|From: *|| p" "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" from="${from% *}" ; from="${from%\"}" ; from="${from#\"}"