On Fri, 21 Jan 2005, Paul Wise wrote:
> I want to set up my Exim filter to deliver mail with the subject "News" to a
> special mailbox, then have a script process the mail, and then archive it.
>
> my .forward file is
> # Exim Filter
>
> #Filter to save mail with "News" in the header to 'newMail'
> #or otherwise throw it away
>
> if $header_subject: contains "News"
> then
> unseen save $home/scripts/news/newMail
> pipe "$home/scripts/news/processNews"
> elif $header_subject: does not contain "News"
> then
> seen finish
> endif
[Note: you can replace 'elif $header_subject: does not contain "News"'
with 'else' and save a bit of work.]
> The problem I have is that the script obviously requires the mail to be
> delivered before it can process it. I have instructed the script to 'sleep'
> before proceeding in the hope that exim would deliver the mail in the
> interim. However it appears that exim will wait for the result of the pipe to
> return before it delivers the mail (as the excellent online manual confirms).
Your filter sets up two deliveries, one to a file, and one to a pipe.
These happen later *in an undefined order*. You cannot rely on one
happening before the other.
> My script needs the whole mail message on which to do its processing,
> including the attachments, so I think I can not include this as an argument
> to the script?
Your script will receive the entire message on its standard input. Is
that not enough?
--
Philip Hazel University of Cambridge Computing Service,
ph10@??? Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book: http://www.uit.co.uk/exim-book