commit e7a5ec954201808f7fed3f5aeb7e9f0c92002ee4
parent 7c5237a240000f605d3611a6cb2022c45ff4a21b
Author: Jake Koroman <jakekoroman@gmail.com>
Date: Sun, 24 Mar 2024 10:12:15 -0400
fixed long subjects getting cutoff on notifications.
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/bin/mailsync b/bin/mailsync
@@ -55,12 +55,13 @@ syncandnotify() {
echo "$newcount new mail 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", $_)')"
+ subject=$(sed -n "/^Subject:.*$/{ p; n; p; }" "$file" | sed 's/MIME.*$//g' | tr -d '\n')
+
from="$(sed -n "/^From:/ s|From: *|| p" "$file" |
perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')"
+
from="${from% *}" ; from="${from%\"}" ; from="${from#\"}"
+
notify "📧$from:" "$subject"
done
;;