procmail
[Top] [All Lists]

RE: Alter Body Based on Looked-up Data

2007-05-30 13:04:33
At 14:24 2007-05-30 -0500, Sokol, Ryan - 244 wrote:
But, as you can see, the email is basically terminated by procmail.  I
have my php script actually recreating an email after parsing through
the data.

If you want to change the message, use the 'f'ilter flag.  poss with 'h' or 
'b'.

I know this is not the best solution.  I'm looking for a way
to let the email go through but after I get the data I need.

If you want to extract data and do something with it, but not actually 
affect the message, then use the 'c'opy flag - run your stuff on a Copy of 
the message - the original continues along to be delivered (or mangled by 
other rules).

Once I have this data (might be html) in the CUSTOM_DATA variable, all I
need to do is prepend it to the body.  This is where it gets tricky and
where I need you guys' help.

Prepending anything to the body has issues - namely, what format and 
encoding the original message is in.

Now, if you want to cram that stuff into message HEADERS, that'd be a LOT 
easier.  If the customer data is in a database, you could just insert a 
header containing a weblink formatted with a query to load up the customer 
data record:

X-HA-Customerid: <http://www.ha.com/private/customerlookup.php?202452071>

3.  Is there a solid way to prepend the email body regardless of format
and still preserve the email structure and components?

Not WITHIN procmail.  You could try belting the message out to mimencode or 
similar (not stuff I generally do myself though).  If you go the route of 
the header, you don't even need to LOOK at the body, much less change 
anything about it.

---
  Sean B. Straw / Professional Software Engineering

  Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
  Please DO NOT carbon me on list replies.  I'll get my copy from the list.


____________________________________________________________
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