# Message is from a known non-spam UCE sender, bounce it # Based on the bounce code from spambouncer by Catherine A. Hampton, http://www.spambouncer.org/ # Modified by paul@it.ca for MIME support, http://www.it.ca/software/procmail-bounce, 2003-06-08 # Modified by fangor @ http://fangor.freeshell.org for multiple To addresses, minor changes MY_EMAIL=(email1\@|email2\@) MY_NAME="Fangor" # Default values if not taken from message and assigned TO=email@domain SPAMTO=email@domain SPAMU=email SPAMH=domain SPAMD=gt05.email@domain # Customize these if they're not right on your system: FORMAIL=/usr/pkg/bin/formail GREP=/usr/bin/grep HEAD=/usr/bin/head SENDMAIL=/usr/sbin/sendmail LS=/bin/ls TR=/usr/bin/tr # Customize these on your system DEFAULT=/mail/fangor MAILDIR=$HOME/mail ############################## # Be extra careful changing info below here SHELL=/bin/sh PATH COMSAT VERBOSE=off LOGABSTRACT=yes LOGFILE=$MAILDIR/.log/log.`date +%y-%m-%d`.bc :0 { RM=/bin/rm DQ='"' BOUNCEPID=`echo $$` } :0 c: .bouncetemp.${BOUNCEPID} # If mail To/Cc field contains a known address take user and domain info :0 * $ ^(To|Cc):.*\/${MY_EMAIL}[^,> ]+ { SPAMTO=$MATCH # If address is bracketed take user and domain info :0 * ^To:.*[<]\/[^@]+ { :0 { SPAMU=$MATCH } :0 * ^To:.*[@]\/[^>]+ { SPAMH=$MATCH } } # Else take user and domain info from non-bracketed address :0 E { :0 * ^To: \/[^@]+ { SPAMU=$MATCH } :0 * ^To:.*[@]\/[^ ]+ { SPAMH=$MATCH } } :0 { SPAMD=mx01\.$SPAMH } } :0 * ^Errors-to:[ ]\/.* { SPAMERROR=$MATCH } :0 { SPAMDATE=`date` } :0 { # For FreeBSD, maybe Linux too: MIMEBREAK="`echo \"$SPAMDATE $$\" | /usr/bin/md5`/${SPAMH}" } :0: bouncetemp.${BOUNCEPID}.lock | ( ${FORMAIL} -rt \ -I"From: MAILER-DAEMON@$SPAMH (Mail Delivery Subsystem)" \ -I"Subject: Returned mail: see transcript for details" \ -I"Auto-Submitted: auto-generated (failure)" \ -I"MIME-Version: 1.0" \ -I"Content-Type: multipart/report; report-type=delivery-status; boundary=${DQ}${MIMEBREAK}${DQ}" \ -A"Bcc: ${SPAMERROR}" \ -A"X-Loop: MAILER-DAEMON@${SPAMH}";\ printf "\nThis is a MIME-encapsulated message\n";\ printf "\n--%s\n\n" "${MIMEBREAK}";\ printf "The original message was received at %s" "${SPAMDATE}";\ printf " from %s\n" "${FROM}";\ printf "\n ----- The following addresses had permanent fatal errors -----\n";\ printf "${SPAMTO}";\ printf "\n (reason: 550 5.1.1 User unknown)\n\n";\ printf " ----- Transcript of session follows -----\n";\ printf "550 5.1.1 %s@%s... User unknown\n" "${SPAMU}" "${SPAMH}";\ printf "\n--%s\nContent-Type: message/delivery-status\n\n" "${MIMEBREAK}";\ printf "Reporting-MTA: dns; %s\n" "${SPAMD}";\ printf "Arrival-Date: %s\n\n" "${SPAMDATE}";\ printf "Final-Recipient: RFC822; %s@%s\n" "${SPAMU}" "${SPAMH}";\ printf "Action: failed\nStatus: 5.1.1\nDiagnostic-Code: X-Unix; 550 5.1.1 User unknown\n";\ printf "Last-Attempt-Date: %s\n" "`date`";\ printf "\n--%s\nContent-Type: message/rfc822\n\n" "${MIMEBREAK}";\ cat .bouncetemp.${BOUNCEPID};\ printf "\n--%s--\n\n" "${MIMEBREAK}";\ ${RM} -f .bouncetemp.${BOUNCEPID} \ ) | ${SENDMAIL} -od -t