[Mimedefang] action_change_header w/ multiple Subjects

Sean Ware sware at midwaygames.com
Thu Oct 20 14:08:29 EDT 2005


Matthew.van.Eerde at hbinc.com (Matthew.van.Eerde at hbinc.com) @ 2005.10.20 10:10:34 -0700:
> I'd like to be able to change the subject for emails detected as spam.
> 
> I've been using
> 	action_change_header("Subject", "[SPAM] $Subject");
> which has worked well until recently.
> 
> Alas, recently there have been spams that put in multiple Subject
> headers.  action_change_header tags the first Subject:, but the MUA
> displays the second! 
> 
> I'm tempted to do something like
> 	action_delete_all_headers("Subject");
> 	action_add_header("Subject", "[SPAM] $Subject");
> 
> but I have some questions...
> 
> 1) Will this work?  Or will action_delete_all_headers("Subject")
> repopulate the $Subject variable?  If so, no problem, I can shadow
> the variable before I call the action_delete_all_headers. 

Yes. It works beautifully. I asked this very question not too long
ago:

http://lists.roaringpenguin.com/pipermail/mimedefang/2005-September/027960.html

I have been running in production with the proposed code I list in the
message linked above for over a month. It does exactly what I intended
it to do.

> 2) Is there a way to detect how many of a given header there are,
> short of slurping ./HEADERS? 

That I don't know. I suspect looking at ./HEADERS is probably your
best course.
 
> 3) Is there a way to make an action_change_all_headers()?

That I also don't know. I did not find such a function on my first
glance.

....Sean

-- 
Sean Ware                          Midway Amusement Games, LLC
Senior Network Engineer                  2727 W. Roscoe Street
Information Technology Department       Chicago, IL 60618-5909
sware at midwaygames.com                           (773) 961-2000




More information about the MIMEDefang mailing list