Re: Getting xfilter AND delivery to working

Milan Obuch <[email protected]> Fri, 5 Feb 2016 00:14:06 +0100
Newsgroups gmane.mail.maildrop
Message-ID <[email protected]>
On Fri, 05 Feb 2016 09:09:48 +1100
Philip Rhoades <[email protected]> wrote:

> Milan,

[ snip ]

> > So let me reiterate:
> > - you receive mail
> > - you need to extract attachment from it
> > - you need to save original mail to designated folder
> > 
> > Did I understand it right?  
> 
> Correct.
> 

Nice, so see below.

[ snip ]

> You are probably right but I don't see how that helps solve the
> problem . . I think it might be easier to take out the xfilter line,
> let the mail be delivered as normal and set up an inotifywait script
> to watch for new files in the appropriate mail dir and then process
> them with my Ruby script . .
> 

No need to do it this way. All you need is just two lines:

`/home/phil/bin/bash_internal_variables.sh > /home/phil/t`
to $DEFAULT/.tst/

(and replace bash_internal_variables.sh with your real script). That's
all. Believe me, just try it. I did. And I am doing various things with
maildrop. Some trial and error, some man pages reading is all that's
required.

Now, we can go a bit deeper. If your original mail is correctly
structured according MIME standard, which should be the norm nowadays,
you could just use reformime. In my case, I use in one recipe the
following:

PA=`reformime -e -s 1.1`

If mail MIME structure is the same everytime, there is nothing more to
do, in your case, it could become

`reformime -e -s 1.2 > /home/phil/t`
to $DEFAULT/.tst/

and you will have in file /home/phil/t just the attachment you wanted.
You just need to adjust -s argument according your mail structure.
It is possible to test structure with reformime with no arguments.
For first experiments with reformime, you could just use

reformime < some_file_name_with_saved_mail

to check structure and then add some arguments to do other useful
things.

Caveat: I am using full Courier mail suite, so I am not sure reformime
is part of standalone maildrop package you are using, but I think it
is.

Regards,
Milan

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140