[Mimedefang] Changing individual addresses to spam mailbox address.

Martin Ferguson martin at mve.com
Mon Oct 6 13:44:01 EDT 2003


Hi,

I have a mimedefang-filter which tags mail as spam with score 6 or higher, then bounces mail with score 15 or higher. I instruct
users to simply use a rule in their mail client to filter the tagged messages out of their inbox. This works for most users, however
I'd like to be able to forward messages for certain addresses which are tagged as spam to a spam mailbox address.
Basically on of our directors wants to forward his spam to someone else for them to check, sigh!
:-( 

To forward all messages tagged as spam to a spam mailbox address is not a problem, I use something similar to;

if ($message_is_spam) {            
# Add a header with original recipients, just for info            
action_add_header("X-Orig-Rcpts", join(", ", @Recipients));            

# Remove original recipients            
foreach $recip (@Recipients) {                
delete_recipient($recip);            
}            

# Send to spam address            
add_recipient('spambox at mydomain.com');        
}       
--------------------------------------------------------------

For individual addresses, I've tried;

if ($message_is_spam) {            
# Add a header with original recipients, just for info            
action_add_header("X-Orig-Rcpts", join(", ", @Recipients));            

# Remove original recipients            
foreach $recip (@Recipients) { 
		
		if ( $recip =~
  
		/first\@addess.com|second\@address.com/i )
		{                
		delete_recipient($recip);            
		}
		}
             
# Send to spam address            
add_recipient('spambox at mydomain.com');
-------------------------------------------------------------

When first at address.com and second at address.com should be the only recipient addresses which get forwarded to spambox at mydomain.com,
instead the addresses on the list and any other addresses still get forwarded to spambox at mydomain.com.

Perl is not my strong point, as you may be able to tell ;-), so anyone help with this filter is greatly appreciated.

Thanks
Martin.	   	
	   





More information about the MIMEDefang mailing list