#!/bin/bash # # Forwards spam with a complain to one or more destinations supplied # in the command line. # if [ $# == 0 ]; then echo "Usage: $0 addr ..." >&2 exit 1 fi msgfile="$(mktemp -t spam-notify.XXXXXX)" # Put the beginning of the message into the temporary file head -c 8k >"$msgfile" # Ditch the rest of the message cat >/dev/null subject="SPAM ALERT [$(formail -c -x From: < "$msgfile"): $(formail -c -x Subject: < "$msgfile")]" mutt -s "$subject" -a "$msgfile" "$@" <