Where is the bug? I'm receiving "Invalid null command.".
What I want to do: return to sender the message if the domain is banned.
Add to the beggining of the message a text. Delete the received message.
This is the recipe:
BAN_REGEXP = "(uol\.com\.br)"
:0
* $ ()\/$BAN_REGEXP
{
reject=$MATCH
# Add text to the beginning of message
:0fbw
| ( echo "Your message was received but not appreciated." ; \
echo "Now bug off." ; echo "Thank you. " ; echo ; sed 's/^/> /' )
:0
* ^Subject:[ ]*\/[^ ].*
| formail -rtkb -I"Subject: Message rejected (was: $MATCH)" -I"From:
postmaster(_at_)wecke(_dot_)com" -I"Precedence: junk"; \
| $SENDMAIL $SENDMAILFLAGS -t
}
:0
*$ 1^1 \/$BAN_REGEXP
*$ -1^1 ^Subject:.*$BAN_REGEXP
/dev/null
-=-=-=-=-=-
I'm receiving this when I run procmail:
procmail VERBOSE=yes DEFAULT=/dev/null /u2/home/hermann/xyz2.rc < mbox.txt
procmail: [7056] Mon Feb 2 21:04:14 1998
procmail: Assigning "DEFAULT=/dev/null"
procmail: Rcfile: "/u2/home/hermann/xyz2.rc"
procmail: Assigning "MAILDIR=/u2/home/hermann"
procmail: Assigning "BAN_REGEXP=(uol\.com\.br)"
procmail: Assigning "MATCH="
procmail: Matched "uol.com.br"
procmail: Match on "()\/(uol\.com\.br)"
procmail: Assigning "reject=uol.com.br"
procmail: Executing " ( echo "Your message was received but not
appreciated." ; \
echo "Now bug off." ; echo "Thank you. " ; echo ; sed 's/^/> /' )"
procmail: Assigning "MATCH="
procmail: Matched "Professional relationship "
procmail: Match on "^Subject:[ ]*\/[^ ].*"
procmail: Assigning "LASTFOLDER= formail -rtkb -I"Subject: Message rejected
(was: $MATCH)" -I"From: postmaster(_at_)wecke(_dot_)com" -I"Precedence: junk"; \
| $SENDMAIL $SENDMAILFLAGS -t"
procmail: Executing " formail -rtkb -I"Subject: Message rejected (was:
$MATCH)" -I"From: postmaster(_at_)wecke(_dot_)com" -I"Precedence: junk"; \
| $SENDMAIL $SENDMAILFLAGS -t"
Subject: Professional relationship
Folder: formail -rtkb -I"Subject: Message rejected (was: $MATCH)" -I
1659
Invalid null command.