[Mimedefang] Help filtering by recipient (To: Line)

Bradley Glonka bglonka at potestivolaw.com
Mon Jul 11 14:56:50 EDT 2005

I want to silently discard emails that are sent to a few certain addresses.
To be clear I want to filter by addresses that appear on the the To: Line
I've done the following, but I'm not having any luck..
First I turned on (in the mimedefang startup script)
Next I added this code near the top of filter_begin() in mimedefang-filter
(in /etc/mail)
if ($recipient =~ /donotsendto at email.com/i) {
            return  action_discard();

I also tried, creating a function just for this (via the man page)
sub filter_recipient {
     my ($rec, $sender, $ip, $hostname, $first, $helo,
              $rcpt_mailer, $rcpt_host, $rcpt_addr) = @_;
        if ($rec =~ /donotsendto at email.com/i) {
            return action_discard();
I think this function should be before the line
Neither of these work --- Any suggestions?

More information about the MIMEDefang mailing list