procmail
[Top] [All Lists]

Reading a list of email addresses from a flat file and piping the same to a procmail recipe

2010-09-21 23:28:49
Hello!

 

I have a requirement where I need to read a huge list of email addresses
(a kind of white list) from a FLAT file and PIPE the results to my
procmail recipe's filter condition for Cc field. If one or more
addresses matches with the value in the Cc field of the incoming email,
I need to append that matched address to the To: field.

 

Currently, I have the following implementation (without using a flat
file).

 

Current Implementation

:0

* !LOGNAME ?? (cem-*)

# List of routing addresses to be compared against the Cc field of the
incoming email

*^Cc:.*[ \<]\/((eaddressOne eaddressTwo| eaddressThree| eaddressFour|
eaddressFive| eaddressSix)@mycompany\.com)

{

  LOG="\$MATCH contains '$MATCH'

  "

  ADDRESS_TO_BE_INSERTED=$MATCH

  LOG="\$ADDRESS_TO_BE_INSERTED contains '$ADDRESS_TO_BE_INSERTED'

  "

 

  :0 hfw

  | /opt/local/bin/formail -i "To: $TO,$ADDRESS_TO_BE_INSERTED"

 

}

 

 

Ideal Recipe (REQUIRED)

An ideal recipe would have the highlighted Cc condition replaced so that
Cc field is compared against all the above addresses which are
physically stored in a FLAT file instead of being listed "in-line" with
the procmail filter condition for Cc.

 

I am not that great with Unix so need some help re-designing this
recipe.

 

In real world, we will have at least 100-150 different email addresses
that need to be matched against the Cc condition and hence the need to
store them in a separate FLAT file (with hopefully one address on each
line).

 

Any help with this will be greatly appreciated as I need to implement
this solution in the next day or two for a release.

 

Thanks and regards,

Komal

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
<Prev in Thread] Current Thread [Next in Thread>