procmail
[Top] [All Lists]

RE: Alter Body Based on Looked-up Data

2007-05-30 18:10:16
Sokol, Ryan - 244 wrote Wednesday, May 30, 2007 11:06 PM:

Thanks for the info on the prepending - that's what I was 
afraid of.  I could go the custom header route, but then how 
would the Outlook users see that link?  Is there something 
easier than user-defined fields?

Well, you could put it in the Subject line.

I need to do is prepend it to the body.  This is where it gets 
tricky and where I need you guys' help.

Is there some reason you have to send back the exact same
format you got?  As I mentioned previously, a tool such as
demime will work fine.

I have set up an auto-responder that I will leave up for
a couple of days, anyway.  Write "dman+procmail(_at_)nomotek(_dot_)com"
with any message style you want and you will get it back
demimed and quoted, with a message prepended.

Here is my code:

######################## start ########################

 TESTADDR = dman+procmail(_at_)nomotek(_dot_)com

 :0
 * $  ^To:(.*\<)$\TESTADDR
 * $ !^X-Loop:(.*\<)?$\TESTADDR
 {
    TESTMSG = "This is a canned message prepended to the body,${NL}"
    TESTMSG = "${TESTMSG}which has been demimed and will be
delivered${NL}"
    TESTMSG = "${NL}${NL}${TESTMSG}back to ${RET_ADDR}."
   
    :0 fw
    | demime --uselynx

    :0
    | formail -rkp "> " -I "X-Loop: ${TESTADDR}${TESTMSG}" \
    | "$SENDMAIL" $SENDMAILFLAGS -t
 }

######################### end #########################

Note that a couple of things were predefined, such as NL
and RET_ADDR.  (I had that available already from my
regular .procmailrc, which the message has run through
by the time it gets here.)

Or if you must have the original format, then do what
LuKreme has just suggested in a follow-up message that
arrived while I was preparing this:

L> Take the original messages and turn it into a RFC2822 attachment.   
L> Prepend your information into the NEW message that has the original  
L> as the attachment.  This is how SpamAssassin works and I think is,  
L> reasonably, the ONLY way this will be workable.

This also happens to be what Bart Schaefer said the day
before yesterday in the recent threadlet I already pointed you
at.  Bart also offered his excellent code to do just that as
an INCLUDERC plug-in.

Dallman


____________________________________________________________
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