procmail
[Top] [All Lists]

selective mail forwarding

1997-06-29 09:37:00
Hello,

I have a dedicated mail box to receive messages, which I
will call "tags."  My goal:  To forward the tag (the entire
e-mail message, full headers et al), to certain addresses, based on
some criteria in the tag itself.

I'm thinking I could do it this way:

        <have procmail output entire message> | \
        <an external perl or c program proccesses message and
                outputs e-mail addresses> | \
        <procmail takes e-mail addresses and forwards messages to them>
        
Assuming I have the external perl or c program, can procmail do its
part in this scheme?  If so, can someone show me what exactly how?

Now, as for the perl or C program I need to process the tag
and return addresses -

The criteria:  In the tag, there is a PROVIDER {} section (refer
to below).  There can be anywhere from 0 to 20 lines in this section.
Each line contains 9 comma delimited fields.  The first two fields of
each line are the ones of interest - they contain acronyms, which
refer to entities.  I will have an external file, call it "acronyms,"
which will have an e-mail address associated with each acronym, like
thus:

SRP     some(_at_)address(_dot_)com
SRPM    some(_at_)other(_dot_)address(_dot_)com
WALC    you(_at_)get(_dot_)the(_dot_)idea

For each acronym found in the first two fields of each line in the
PROVIDER {} section, I need a perl or C proram to return the
corresponding e-mail address.  Furthermore, two or more acronyms may
have the same address associated with it...  I do not want the
same address to be returned more than once.  Can someone help me
with this perl or C program also?  I know many of you are perl
gurus as well.

Thanks for any help!  Below is an example of a tag.

-tam

[begin tag]

"SRP_EPMI000G001_NEVP.TAG","V1.0","NTT"
TAG,{
"REQUEST","06/17/97","06/17/97","PD","T=grandfathered transmission",
},1
REQUESTOR,{
"EPMI","000G001",7000,"Kevin 
McGowan","713-853-7493","333-444-5555","777-888-9999"
},1
POR,{
"SRP","602-236-3841",""
},1
POD,{
"NEVP","",""
},1
PROVIDER,{
"SRP",,"SRPM","G;F",,,"","",""
,"SRP","SPRM","F","SRP-LIB","T","","",""
"WALC",,,,"LIB",,"","",""
,,"SRPM","F","LIB-MED2",,"","",""
,,,,"MED2",,"","",""
,"NEVP","NEVPP","F","MED2-NEVP","T","","",""
"NEVP",,"NEVPP","L",,,"","",""
,,,,,,"","",""
,,,,,,"","",""
,,,,,,"","",""
,,,,,,"","",""
,,,,,,"","",""
,,,,,,"","",""
,,,,,,"","",""
,,,,,,"","",""
,,,,,,"","",""
,,,,,,"","",""
,,,,,,"","",""
,,,,,,"","",""
,,,,,,"","",""
},20
ENERGY,{
"15:00","20:00",50,250,"14:50",20
"","",,,"19:50",20
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
"","",,,"",
},24
LOSS,{
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
,"","",,,
},24
END
[end tag]

<Prev in Thread] Current Thread [Next in Thread>