[Mimedefang] RE: Testing mailing list headers

Kees Cook kees at osdl.org
Sat Apr 10 12:58:45 EDT 2004


On Fri, Apr 09, 2004 at 09:14:45PM -0400, David F. Skoll wrote:
> You can open the file ./HEADERS, which contains all headers, one per line.
> Multi-line headers are "unwrapped" to be on a single line for convenience.

You can modify the following code to create a hash of header/value pairs.  
I just test for the existence of a header:

sub filter_begin () {
    # Check and see if this is a mailing list
    $FromMailingList=0;
    if (open(HDRS, "<HEADERS")) {
        while(<HDRS>) {
             my($header,$value)=split(/:/,$_,2);
             $header=lc($header);
             if ($header eq "x-mailing-list" ||
                 $header eq "list-id") {
                        $FromMailingList=1;
             }
        }
        close(HDRS);
    }   
....


-- 
Kees Cook
Open Source Development Lab
kees at osdl.org



More information about the MIMEDefang mailing list