procmail
[Top] [All Lists]

Re: howto forwarding a part of a multipart message

2005-05-05 03:09:37
On Tue, May 03, 2005 at 02:46:53PM -0600, Goku Cacaroto wrote:

I'd recommend piping to an external program such as Courier
Mail's reformime to extract the desired part.  The rest we could
help you with, once you decide on a program to use to extract
it.

I have one named metamail. what is the next step?

I don't know that metamail can do this so easily.  I suggested
reformime because -- well, here is from its man pages:


       -X     Pipe the contents of the indicated MIME section to a program.

   EXTRACTING RFC 2045 MIME SECTION(S) TO FILE(S)
       The -x and -X options extract a specific MIME section to a file or to a
       pipe to an external program.  Use the -s option to  identify  the  MIME
       section to extract.  If the -s option is not specified, every MIME sec-
       tion in the message is extracted, one at a time.  quoted-printable  and
       base64 encoding are automatically decoded.

I see nothing similar in metamail's man pages.

Once you can extract sections and pipe sections, you pretty much can
build what you want fairly easily.  I am not going to build your
function all for you, especially based on a theoretical program you
do not have installed right now.  In any case, I think that kind of
goes beyond the limits of how helpful this list can be (which is very
helpful).  But the way it's supposed to happen here is, you try something
and have trouble, then we[1] help steer you back on path.  It's not,
however, that we're going to become freebie distant mail admins for
a system and do everything from scratch.


[1] "We," of course, is not some homogonized group, but is rather this
rag-tag group of interested procmail users and fans who volunteer to
help each other out, well, just because, and because it is part of
their belief in how to build a community.

Perhaps you are unaware of the complexity of what you are asking.
It's not so easy manipulating MIME stuff around, and certainly not
approachable for a non-expert in procmail only.  Even with the
tools, well, you have to be able to decide on what basis you're going
to know which MIME parts you want to extract, you have to rewrite
the MIME header on the way out, etc.  It's no cakewalk!

I have nothing like that in place right now, and cobbling it together
from scratch would take me an hour or two.  Perhaps another user who
has done this -- I've seen one or two such things floated here in the
past few years -- will chip in with some more specific advice.  (Do
check the searchable archives.)

In any case, the general idea would be:

   :0
   * some condition or conditions to decide this is the right message
   * some condition or conditions to decide -- perhaps with scoring \
     (see 'man procmailsc') which section we want to extract
   {
      mysection = $=    # assumes we were using weighted scores in
                        # the conditions; this saves the total

      :0 fw i  c  # "c" only if you want to keep a copy yourself
      | reformime -X -s $mysection -possible-other-flags/switches | ;\
        $SENDMAIL $SENDMAILFLAGS  your(_at_)forward(_dot_)address
   }


That is just a rough theoretical start, of course; a conceptual
algorithm.

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

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