You are using an outdated browser which puts all net citizens at risk. As an incentive to upgrade to a current and thus much more secure product (we recommend the free Firefox browser), you won't be able to visit this site in its cute design, but in this rather boring printer-ready version only. Thank you for considering a browser update!

sendmail-notifier

This is a followup to the sendmail via Growl article a while ago.

Growl has become somewhat obsolete on Mac OS X 10.8. However, with a few modifications, local mail sent by use of sendmail can be displayed as notification center messages instead.

Bye sendgrowl, hello sendmail-notifier

Here's the updated script:

#!/bin/bash

case "$1" in
  --help | -h )
    echo "sendmail-notifier [--on|--off|--show ID]"
    exit
    ;;
  --on | -1 )
    for bin in "/usr/sbin/sendmail" "/usr/local/sbin/sendmail"; do
      if [ -e "$bin" -a ! -e "$bin-OSX" ]; then
        sudo mv "$bin" "$bin-OSX"
        sudo ln -s "$0" "$bin"
      fi
    done
    exit
    ;;
  --off | -0 )
    for bin in "/usr/sbin/sendmail" "/usr/local/sbin/sendmail"; do
      if [ -h "$bin" -a -e "$bin-OSX" ]; then
        sudo rm -f "$bin"
        sudo mv "$bin-OSX" "$bin"
      fi
    done
    exit
    ;;
  --show | -s)
    if [ -e "/tmp/sendmail-notifier/$2.eml" ]; then
      open "/tmp/sendmail-notifier/$2.eml" >/dev/null
    fi
    exit
    ;;
  --edit | -e)
    if [ -e "/tmp/sendmail-notifier/$2.eml" ]; then
      $EDITOR "/tmp/sendmail-notifier/$2.eml"
    fi
    exit
    ;;
esac

mkdir -m 0777 /tmp/sendmail-notifier 2>/dev/null
find /tmp/sendmail-notifier/ -mtime +30 -exec rm {} ;
cat >"/tmp/sendmail-notifier/$$.eml"
terminal-notifier 
  -title "sendmail" 
  -subtitle $$ 
  -message "$(sed '/^X-/d' /tmp/sendmail-notifier/$$.eml | head -n 30)" 
  -execute "open /tmp/sendmail-notifier/$$.eml" 
  >/dev/null

(Sven Schwyn)

(We are remaking our web presence and therefore comments are temporary disabled.)