procmail
[Top] [All Lists]

Re: Alter Body Based on Looked-up Data

2007-05-30 13:09:34
* Sokol, Ryan - 244 <ryans(_at_)ha(_dot_)com> [05-30-07 15:36]:

I'm not looking to hire anyone.  I just want to know the following:

1.  Is my goal achievable/feasible?
2.  I know how to get the email address (via my php script).  I've got
this recipe working:

:0
| /usr/local/bin/php $HOME/getAndSend.php; \
  cat > /dev/null

But, as you can see, the email is basically terminated by procmail.  

by your choice.  It's how you wrote the recipe

I have my php script actually recreating an email after parsing
through the data.  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.

from TFM (procmailrc):

You can tell procmail to treat a delivering recipe as if it were a
non-delivering recipe by specify‐ ing the c' flag on such a recipe.
This will make procmail generate a carbon copy of the mail by
delivering it to this recipe, yet continue processing the rcfile.

operate on the copy and let the original be delivered intact

I think I can do this with a recipe like this:

:0
CUSTOM_DATA = | /usr/local/bin/php $HOME/getCustomBodyPrependData.php

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.
3.  Is there a solid way to prepend the email body regardless of format
and still preserve the email structure and components?

man formail, search for "extract the header/body"

looks like:
  1.  obtain email address of customer, you have
  2.  extract header and body (separately) from copy of msg
  3.  cat {your custom file} and the body
  4.  reassamble header and new body
  5.  deliver

and now you have 99% of your solution at your fingertips.

RTFM is your friend   :^)
-- 
Patrick Shanahan         Plainfield, Indiana, USA        HOG # US1244711
http://wahoo.no-ip.org     Photo Album:  http://wahoo.no-ip.org/gallery2
OpenSUSE Linux                                   http://en.opensuse.org/
Registered Linux User #207535                    @ http://counter.li.org

____________________________________________________________
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>