OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: .mailfilter trouble

From: Aurelien Barrere (abarrereemailvision.com)
Date: Fri Nov 04 2005 - 03:41:56 CST


mouss wrote:

> Aurelien Barrere a écrit :
>
>> I configured postfix with maildrop and .mailfilter mechanism but
>> unfortunately the message is not rejected as I expected
>> I wrote a mail to Xdomain.com with in subject "out of office", I
>> want this mail to be rejected when matching this pattern
>
>
> I hope you mean discard or put in a some junk folder. if you reject at
> mda level, that results in a bounce, thus backscatter (because sender
> may be forged).
> anyway this is a question for the maildrop ML. In the meantime, read
> below
>
>> [snip]
>> if ((/.*[Oo]ffice/:hb))
>
>
> ahuh. This would match things like:
> From: mouss-officeexample.com
> Received: from foo.office-depot.com ...
> Subject: when will you come at our office?
> ...
> use
> if (/^Subject:\s*out of office\s*$/)
> instead. always be as specific as you can. and don't look for "out of
> office" in the body.
>
ok I copy paste your regexp that is more accurate to my need, thanks a lot
(in .mailfilter)
if (/^Subject:\s*out of office\s*$/)
{
    filter_out=1
}

>> {
>> filter_out=1
>> }
>> if ( $filter_out==1 )
>> {
>> exit
>
>
> I believe "exit" is not the right choice, nor is "to /dev/null". You
> need to set an exit code but I don't remember which one. search
> maildrop ML archive or ask there.
>
> better yet, put these in a specific folder so that you can check them
> quickly if you want (maybe with the help of a script to grep mail from
> some people ... etc). if so, use "to Maildir/.OutOfOffice/" for
> instance (the folder must be created in advance (or here with a
> maildirmake shell cmd).
>
You right! I created a folder .Trash into Maildir and I updated
.mailfilter with

if ( $filter_out==1 )
{
# exit
to "./Maildir/.Trash"
}

But unfortunately even after modification I still have mail (out of
office in subject) forwarded instead of being rejected.See below:

Nov 4 10:15:05 bounc postfix/local[27255]: 37EC8AC6C6:
to=<Xdomain.com>, relay=local, delay=0, status=sent (forwarded as
45D46AC6C8)

I have a ".forward" file in my $HOME pointing to my adress but i want
this file being process at the last filter rule entries position.
The problem seems that .forward file is read in first position.

What i expected is : postfix->maildrop -d {USER}->.mailfilter->if
subject=out of office->Maildir/.Trash else forward message accordind
.forward file

What do you suggest to me?

--
Aurelien