Re: Getting xfilter AND delivery to working

Philip Rhoades <[email protected]> Fri, 05 Feb 2016 09:09:48 +1100
Newsgroups gmane.mail.maildrop
Message-ID <b78c3331be15c09ac79960716c11d24a@localhost>
Milan,


On 2016-02-05 08:36, Milan Obuch wrote:
> 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?


Correct.


> [ 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.


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

Thanks,

Phil.
-- 
Philip Rhoades

PO Box 896
Cowra  NSW  2794
Australia
E-mail:  [email protected]

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