#!/bin/sh
# Check for new email, save result to file.
# Requires: mpop, notify-send or similar
file="$XDG_DATA_HOME/newmail"
#notify="notify-send"
notify=herbe
l=$(cat "$file")
n=$(mpop -s | awk '/new*./{print $2}')
if [ -n "$n" ]; then
echo "$n" > "$file"
if [ "$n" != "no" ] && [ "$l" != "$n" ]; then
$notify "New email ($n)"
fi
fi