From 936e17a9d819a6f55bec09eafd1beec523dcaa64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Tue, 23 Aug 2016 22:46:36 +0200 Subject: Add newmail-notify and some other small tweaks --- local/sbin/newmail-notify | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 local/sbin/newmail-notify (limited to 'local/sbin') diff --git a/local/sbin/newmail-notify b/local/sbin/newmail-notify new file mode 100755 index 0000000..65655b4 --- /dev/null +++ b/local/sbin/newmail-notify @@ -0,0 +1,22 @@ +#!/bin/bash + +cd ~/.mail + +if [ -f notify-notified ]; then + NOTIFIED=`cat notify-notified` + rm notify-notified +fi + +for account in `ls`; do + if cd "$account"/INBOX/new; then + for m in `ls`; do + echo $m + echo $m >> ~/.mail/notify-notified + if echo "$NOTIFIED" | grep "$m" >/dev/null; then continue; fi + FROM=`grep -E "^From: " "$m" | sed 's/^From: //'` + SUBJECT=`grep -E "^Subject: " "$m" | sed 's/^Subject: //'` + notify-send "Email: $account" "$FROM: $SUBJECT" + done + fi + cd ~/.mail +done -- cgit v1.2.3