#!/bin/sh # # Copyright (c) 2005, Adam Bernstein, All Rights Reserved. # See http://mpgedit.org/approver/index.html#copyright for licensing terms. # # Hack to work around the fact that sendmail will not execute a # pipeline containing multiple commands connected together. # # This script calls demime (http://scifi.squawk.com/demime.html), a Perl # script to rip out all mime types embedded within an e-mail, then pass # the stripped e-mail along to majordomo. The arguments to resend come from # the command invoked from sendmail, as configured in the /etc/aliases file. # # Demime first, then approve then majordomo. Demime allows approved # to trigger off of the mime header for inserting the approved header. # When approved fails, a non-zero exit status is returned. In that case, # nothing is even sent to resend. # # Comment out this line if you already have DEMIME configured, and have a # demime_junkmail.cf file configured in your environment. ADREMOVE="--noadremove" MAILFILE="/tmp/rmmime_$$" /etc/smrsh/wrapper demime $ADREMOVE - | \ /etc/smrsh/wrapper approved > "$MAILFILE" if [ $? -eq 0 ]; then cat "$MAILFILE" | /etc/smrsh/wrapper resend $* fi rm -f "$MAILFILE"