Notify-send and procmail to get new email notification.

I don't want to use/install mail-notification software for the simple task to notify when a new mail arrives. Consider also that my Incoming mail chain is:

fetchmail -> procmail -> mh_folders

so I added this config to my procmail config file.

:0hc
|grep "^From:\|^Subject:" > /run/user/1000/mail.notify-send; DISPLAY=:0.0 notify-send --icon=/usr/share/icons/gnome/32x32/actions/mail-message-new.png "`cat /run/user/1000/mail.notify-send`"; aplay --quiet --nonblock ~/wavs/incoming_message.wav

[Update 05/2018: Using DBUS SESSION instead of DISPLAY]

## pulseaudio
:0hc
|grep "^From:\|^Subject:" > /run/user/1000/mail.notify-send; DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send --icon=/usr/share/icons/gnome/32x32/actions/mail-message-new.png "`cat /run/user/1000/mail.notify-send`"; paplay --volume=20000 /home/enrico/wavs/incoming_message.wav

note: /run/user/1000 should be changed to your $XDG_RUNTIME_DIR

[Update 09/2018: Using perl to show utf-9 Subject]

## pulseaudio
:0hc
| formail -X "From:" -X "Subject:" | perl -X -MEncode=from_to -pe 'from_to $_, "MIME-Header", "utf-8"' > /run/user/1000/mail.notify-send; DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send --icon=/usr/share/icons/gnome/32x32/actions/mail-message-new.png "`cat /run/user/1000/mail.notify-send`"; paplay --volume=20000 /home/enrico/wavs/incoming_message.wav