Re: Getting xfilter AND delivery to working

Milan Obuch <[email protected]> Thu, 4 Feb 2016 22:36:34 +0100
Newsgroups gmane.mail.maildrop
Message-ID <[email protected]>
On Fri, 05 Feb 2016 08:06:16 +1100
Philip Rhoades <[email protected]> wrote:

[ snip ]

> > I think your misused xfilter command. It looks like what you want
> > to do is some environment logging for testing.  
> 
> 
> Actually I thought that bash script would just be a convenient test - 
> what I eventually want to do is run a Ruby script that extracts an
> CVS attachment from the mail, processes it and writes a the output to
> a file 
> - but of course I do not want to lose the original email . .
> 

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?

[ snip ]

> That also works but the email is still not delivered as well . . an 
> example I found in the docs is for reversing characters in lines of 
> text:
> 
>    xfilter "$HOME/reverse.sh"

[ snip ]

> I used:
> 
>    xfilter "/home/phil/bin/reverse.sh > /home/phil/t"
> 
> which, like my script worked in creating the appropriate file "t",
> but still does not deliver the email for the "to" line . .
> 

Because you did the same with other command. Remember, if you are
redirecting stdout (with > /home/phil/t at the end of command), there
is nothing written to stdout, output of command is redirected to file.

Quote from man page, again, xfilter paragraph:

The output of the filter program replaces the current message being
delivered.

I think more verbose and descriptive of the above sentence would be:

After xfilter statement is run, whatever is output to stdout is being
delivered instead of original mail message.

In your example, there was no output to stdout (everything was captured
and put into file), so instead of original mail message, empty file was
being considered for delivery. I did not check in sources, but I think
if message is zero sized, no delivery attempt is being made.

To check this, instead of your

xfilter "/home/phil/bin/reverse.sh > /home/phil/t"

use

xfilter "/home/phil/bin/reverse.sh > /home/phil/t; echo any text"

and there should be message for delivery, however, with only 'any
text', not original message as you are trying to do, I think.

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