I can't get the following recipe to work right. :0 * ^From.*<domain> ! ? formail -x"From" -x"From:" \ | egrep -is -f whitelist | ( formail -rI"From: Automated Response <no-reply@<mydomain>.org>"; \ echo "Your message has not been delivered because the recipient's postmaster has decided not to accept mail from your domain. " \ "If you think this is in error, please contact your intended recipient by another means and have them place your address " \ "on a white list so that it will be delivered from now on. Thank you for your patience." \ ) | $SENDMAIL -oi -t Code (markup): The basic idea here is that I want to block all messages from a certain domain with the exception of a few address I know to be valid and not spammers. I also want to send back a bounce message so the sender doesn't assume the message got through. If I do just the following, then the "bounce" message works fine: :0 * ^From.*<domain> | ( formail -rI"From: Automated Response <no-reply@<mydomain>.org>"; \ echo "Your message has not been delivered because the recipient's postmaster has decided not to accept mail from your domain. " \ "If you think this is in error, please contact your intended recipient by another means and have them place your address " \ "on a white list so that it will be delivered from now on. Thank you for your patience." \ ) | $SENDMAIL -oi -t Code (markup): But when I throw the white list feature on it stops working. By that I mean, regardless of whether the address is in the white list the message seems to get lost. I get no bounce message and nothing gets delivered. Fortunately that only happens to mail from that domain, buuuuut it's not working like I want. The problem seems to be my negation of the formail piped to egrep. For some reason that doesn't work right. I can get it to "work" if I use it as a black list, but not as a white list. This successfully matches the message if the from address is listed in the black list: * ? formail -x"From" -x"From:" \ | egrep -is -f blacklist Code (markup): But, this does not match the message even if the address is not listed in the white list: ! ? formail -x"From" -x"From:" \ | egrep -is -f whitelist Code (markup):
AAAH!!! I got it... I left off the * at the beginning of the line so it thought it was supposed to be forwarding it or something... here's the updated working recipe in case anyone is interested: :0 * ^From.*<domain> * !? formail -x"From" -x"From:" \ | egrep -is -f whitelist | ( formail -rI"From: Automated Response <no-reply@<mydomain>.org>"; \ echo "Your message has not been delivered because the recipient's postmaster has decided not to accept mail from your domain. " \ "If you think this is in error, please contact your intended recipient by another means and have them place your address " \ "on a white list so that it will be delivered from now on. Thank you for your patience." \ ) | $SENDMAIL -oi -t Code (markup):