This is a discussion on Re: Header Checks, examples? within the mailing.postfix.users forums, part of the Mail Servers and Related category; On Friday 18 February 2005 02:48, Michael Nguyen wrote: > Hmm....maybe I can't do things in the ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
On Friday 18 February 2005 02:48, Michael Nguyen wrote:
> Hmm....maybe I can't do things in the way that I initially planned, > but is there anything else I could do using the header_check > functionality that I have available to me? The situation is like > this: > > - Email comes into a server > - If the email hasn't already been forwarded to the filtering server > once, forward it > - If the email has touched the filtering server, deliver it > > We do this with our current MTA by either slapping a header > (x-sa-scanned) into the message if the header doesn't exist and > forwarding to the scanner or merely delivering the message if the > x-sa-scanned header exists. > > That part of procedure is unimportant. The general idea of sending > the email to the scanner if it hasn't been there yet and delivering > the email if it has been there is what I want to accomplish. I feel > like Postfix can do this. Does anyone here have any ideas on how I > could implement this? That sounds like a job for a content filter (see http://www.postfix.org/FILTER_README.html) or possibly a delivery agent such as procmail. Note that using procmail means that outgoing or forwarded (using aliases) mail will never be scanned. The only time to do what you want is after the entire email has been received. Any decent content filter can check for various message characteristics, including the presence of a header line. > > So, the expression > > > > !/^Subject: / WHATEVER > > > > will not match messages that have no Subject line, it will match > > all messages that contain a header that does not match the > > expression (i.e. all messages will be matched). > > Well....maybe I lack creativity here, but in that case I can't think > of a single example where !/<pattern>/ would be useful. I don't use these patterns, but this (crude example) occurs to me: # subject line checks. ignore forwarded messages. if /^Subject: / if !/^Subject: FW / /evil pattern/ REJECT endif endif # don't ever check received lines !/^Received: / OK And keep in mind that OK in header and body checks means skip to the next line, not accept this message. -- Marshal Newrock Ideal Solution, LLC - http://www.idealso.com |