procmail
[Top] [All Lists]

Re: change attachment to inline

2002-08-26 04:34:19
I try to change the incoming email header with subject contain "webcam"
from Content-Disposition: attachment
to   Content-Disposition: inline
without any success,
does anyone what I did wrong?

:0 B
* ^Subject.*WebCam
* $ ^Content-Disposition:
* attachment
{
  :0 fbw
  | /bin/sed -e 's/attachment/inline/'
  WebCAM
}

You're using the 'B' flag, which causes just the body of the mail to be
checked.  But the Subject: is in the header.  And I think (although I
have to admit that I don't pay a lot of attention to MIME) that the
Content-Disposition can be in the body *or* the header.  The '$' at the
start of the 'Content-Disposition' condition doesn't do anything useful
there. And you'll match on any mails with the subject webcam and *any*
Content-Disposition if the mail also contains 'attachment' anywhere in
the body.

In the nesting block, you'll change the text 'attachment' to 'inline'
even if it is not on a line with 'Content-Disposition'.  And the word
'WebCAM' there will do nothing at all - what did you have in mind with
that?

You will find *much* better MIME-handling recipes than the below in the
list archives, but I suspect you want something more like:

  :0 fbhw
  * ^Subject:.*webcam
  * HB ?? ^Content-Disposition:.*\<attachment\>
  | /bin/sed 's/\(Content-Disposition: *\)attachment/\1inline/'

Or something like that.  No need for a nesting block, unless that
'WebCAM' is supposed to be doing something.

Oh - is it a mailbox you want to deliver to?  In which case it is not
legal syntax.  It needs a colon line to go with it.  E.g.

  :0
  * ^Subject:.*webcam
  * HB ?? ^Content-Disposition:.*\<attachment\>
  {
    :0 fbhw
    | /bin/sed 's/\(Content-Disposition: *\)attachment/\1inline/'

    :0:
    WebCAM
  }



or alternatively,


  :0 fbhw
  * ^Subject:.*webcam
  * HB ?? ^Content-Disposition:.*\<attachment\>
  | /bin/sed 's/\(Content-Disposition: *\)attachment/\1inline/'

  :0 a:
  WebCAM

Hope that helps,
Martin
-- 
Martin McCarthy                 /</    http://procmail.non-prophet.org
    `Procmail Companion'        \>\
     Addison Wesley             /</                  PGP key available
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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