procmail
[Top] [All Lists]

Re: New Cook... Recipe Help

2001-01-21 09:51:48
Hello,

I am trying
  :0
  * ^Content-type:.*(image|video)/*
  * HB ?? Content-transfer-encoding:.*(x-uuencode|base64)
  * ! ^X-Loop: *brian(_at_)(_dot_)*jbbent(_dot_)com
  {
      LOCKFILE=munpack.lock
      TMPDIR=/home/brian

      :0
FARGS='munpack -C $TMPDIR 2>&1 |grep -v -e "reading from standard input" -e '^$SPC$' |sed -e "s,^,-A 'X-munpack-info: $TMPDIR/," -e "s/$/'/"`

        :0 fhw
        | eval formail $FARGS | cat

        LOCKFILE
    }

and in this form I do not even get a log file entree so I know I messed something up I just don't know what.

To help understand I am trying to save any image|video attachment that i receive to a specific directory on the server. Thus extracting it from the message and putting it where a web server will see it.
I just have no clue how do it (obviously).

In the original it was dealing with text files so I removed that I may need to put it back?



IAt 03:51 PM 1/12/01 -0800, Collin Park wrote:
"Brian C. Doyle" wrote:
> Here is what i have for a recipe currently.
> :0:
> * HB ?? ^Content-type:.*image/*
> * ^(From)(_dot_)*brian(_at_)jbbent(_dot_)com
> me
>
> :0:
> * HB ?? ^Content-type:.*video/*
> * ^(From)(_dot_)*brian(_at_)jbbent(_dot_)com
> me
>
> :0
> * ^(From)(_dot_)*brian(_at_)jbbent(_dot_)com
> /dev/null
>
>
> I have 2 questions.
>
> How can I condense the above so i do not have 3 separate entrees for 1
> message.  IE If the email is from brian(_at_)jbbent(_dot_)com and has an 
image or
> video attachment move to me Else if it is from brian(_at_)jbbent(_dot_)com 
and does
> not have an image or video attachment delete!
>

    :0
    * ^From(_dot_)*brian(_at_)jbbent(_dot_)com
    {
        :0:
        * HB ?? ^Content-type:.*(image|video)/
        me

        :0
        /dev/null
    }

> The second deals with taken the attachments and automatically saving them
> to a directory on my computer and then delete the email.  I have seen
> several script but I do not understand what they were doing !!

What exactly is your question?  How to do it?  You could start with
what you see in:

    http://MailMan.RWTH-Aachen.DE/pipermail/procmail/2000-June/000220.html

Maybe if the munpack is successful, you can delete the body before
saving, like this:

  :0
  * ^Content-type:.*(multipart/mixed|application/(.*ms|x-v))
  * HB ?? Content-transfer-encoding:.*(x-uuencode|base64)
  * ! ^X-Loop: *yourName(_at_)(_dot_)*YourDomain
  {
      LOCKFILE=munpack.lock

      TMPDIR=/tmp/mail

      :0
      UnpackOutput|=sed -e \
        '/^Content-[Tt]ype:.*[Nn]ame=/s,[Tt]ext/,application/,' | \
        munpack -C $TMPDIR 2>&1

      :0 afbwi
      | echo unpacked by munpack into $TMPDIR; echo "$UnpackOutput"

      LOCKFILE
  }

The above is NOT TESTED, your mileage may vary, etc.

--
Neither I nor my employer will accept any liability for any problems
or consequential loss caused by relying on this information.  Sorry.
Collin Park                         Not a statement of my employer.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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