Scrip Help
am 04.01.2006 10:09:53 von Kev
im seting up a scrip pipe for postfix + spamassassin as a filter in
postfix.
this really works how ever i have a prb with the FWD depending on the
recipent, can any one help me with this line
if $EGREP -q -i "To: *kav@domain.net*" < /var/tempfs/out.$$
how can i tell egrep to check for any format of To: in the email heder.
===================
SENDMAIL="/usr/sbin/sendmail.postfix -i"
EGREP=/bin/egrep
EX_UNAVAILABLE=69
SPAMLIMIT=5
trap "rm -f /var/tempfs/out.$$" 0 1 2 3 15
cat | /usr/bin/spamc -u filter > /var/tempfs/out.$$
if $EGREP -q "^X-Spam-Level: \*{$SPAMLIMIT,}" < /var/tempfs/out.$$
then
KEV=kalinga@orbitsl.net
if $EGREP -q -i "To: *kev@domain.net*" < /var/tempfs/out.$$
then
$SENDMAIL admin@domain.net < /var/tempfs/out.$$
else
$SENDMAIL spam@domain.net < /var/tempfs/out.$$
fi
else
$SENDMAIL "$@" < /var/tempfs/out.$$
fi
exit $?
======================================
thanks a lot
Kev
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Scrip Help
am 04.01.2006 16:25:25 von Scott Taylor
Kev said:
> im seting up a scrip pipe for postfix + spamassassin as a filter in
> postfix.
>
> this really works how ever i have a prb with the FWD depending on the
> recipent, can any one help me with this line
>
> if $EGREP -q -i "To: *kav@domain.net*" < /var/tempfs/out.$$
>
> how can i tell egrep to check for any format of To: in the email heder.
You did. Perhaps something else in your query is blocking you, or maybe
you just want grep, it doesn't look like you are using "Extended Regex"
here.
'man grep' might be some more help to you.
However, why reinvent the wheel?
http://www.procmail.org/
GL
--
Scott
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re[2]: Scrip Help
am 05.01.2006 03:31:50 von Kev
On Wed, 4 Jan 2006 07:25:25 -0800 (PST)
"Scott Taylor" wrote:
>
> Kev said:
> > im seting up a scrip pipe for postfix + spamassassin as a filter in
> > postfix.
> >
> > this really works how ever i have a prb with the FWD depending on the
> > recipent, can any one help me with this line
> >
> > if $EGREP -q -i "To: *kav@domain.net*" < /var/tempfs/out.$$
> >
> > how can i tell egrep to check for any format of To: in the email heder.
>
> You did. Perhaps something else in your query is blocking you, or maybe
> you just want grep, it doesn't look like you are using "Extended Regex"
> here.
>
> 'man grep' might be some more help to you.
yeah i got it to work with the way i have put there, but the prb is that
email addred comes as many formats like
To: "Kev"
To: Kev
To:
To: "Kev"
etc etc.... so my above way dont work :(
> However, why reinvent the wheel?
> http://www.procmail.org/
>
thank you for the input but this box act as a relay for the exchange
servers in the local network, so i dont think procmail can do the fwd
part with out a .forward, if im not mistaken.
rgds
Kev
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Re[2]: Scrip Help
am 05.01.2006 04:18:54 von Tim Walberg
On 01/05/2006 08:31 +0600, Kev wrote:
>>
>> On Wed, 4 Jan 2006 07:25:25 -0800 (PST)
>> "Scott Taylor" wrote:
>>
>> >
>> > Kev said:
>> > > im seting up a scrip pipe for postfix + spamassassin as a filter in
>> > > postfix.
>> > >
>> > > this really works how ever i have a prb with the FWD depending on the
>> > > recipent, can any one help me with this line
>> > >
>> > > if $EGREP -q -i "To: *kav@domain.net*" < /var/tempfs/out.$$
>> > >
>> > > how can i tell egrep to check for any format of To: in the email heder.
>> >
>> > You did. Perhaps something else in your query is blocking you, or maybe
>> > you just want grep, it doesn't look like you are using "Extended Regex"
>> > here.
>> >
>> > 'man grep' might be some more help to you.
>>
>> yeah i got it to work with the way i have put there, but the prb is that
>> email addred comes as many formats like
>>
>> To: "Kev"
>> To: Kev
>> To:
>> To: "Kev"
>>
>> etc etc.... so my above way dont work :(
Something like:
$EGREP -q -i '^To:.*'
should do the job - note the couple of differences:
^ to match only at beginning of line
.* to match any number of any character other than newline
between To: and the e-mail address enclosed in brackets
One subtle (?) bug in your original is that it says, roughly, "match
the literal string "To:" followed by zero or more space characters
followed by the literal string "kav@domain.ne" followed by zero or
more 't' characters. In other words, "To:kav@domain.ne" would match,
as would "To: kav@domain.nettttttttttttttttt"...
tw
--
+--------------------------+------------------------------+
| Tim Walberg | twalberg@mindspring.com |
| 830 Carriage Dr. | www.mindspring.com/~twalberg |
| Algonquin, IL 60102 | |
+--------------------------+------------------------------+
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re[4]: Scrip Help
am 05.01.2006 05:27:47 von Kev
On Wed, 4 Jan 2006 21:18:54 -0600
Tim Walberg wrote:
> On 01/05/2006 08:31 +0600, Kev wrote:
> >>
> >> On Wed, 4 Jan 2006 07:25:25 -0800 (PST)
> >> "Scott Taylor" wrote:
> >>
> >> >
> >> > Kev said:
> >> > > im seting up a scrip pipe for postfix + spamassassin as a filter in
> >> > > postfix.
> >> > >
> >> > > this really works how ever i have a prb with the FWD depending on the
> >> > > recipent, can any one help me with this line
> >> > >
> >> > > if $EGREP -q -i "To: *kav@domain.net*" < /var/tempfs/out.$$
> >> > >
> >> > > how can i tell egrep to check for any format of To: in the email heder.
> >> >
> >> > You did. Perhaps something else in your query is blocking you, or maybe
> >> > you just want grep, it doesn't look like you are using "Extended Regex"
> >> > here.
> >> >
> >> > 'man grep' might be some more help to you.
> >>
> >> yeah i got it to work with the way i have put there, but the prb is that
> >> email addred comes as many formats like
> >>
> >> To: "Kev"
> >> To: Kev
> >> To:
> >> To: "Kev"
> >>
> >> etc etc.... so my above way dont work :(
>
> Something like:
>
> $EGREP -q -i '^To:.*'
>
> should do the job - note the couple of differences:
>
> ^ to match only at beginning of line
> .* to match any number of any character other than newline
> between To: and the e-mail address enclosed in brackets
>
> One subtle (?) bug in your original is that it says, roughly, "match
> the literal string "To:" followed by zero or more space characters
> followed by the literal string "kav@domain.ne" followed by zero or
> more 't' characters. In other words, "To:kav@domain.ne" would match,
> as would "To: kav@domain.nettttttttttttttttt"...
>
Thanks a lot, i will test this and let u know....
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re[4]: Scrip Help
am 05.01.2006 10:20:11 von Kev
On Wed, 4 Jan 2006 21:18:54 -0600
Tim Walberg wrote:
> On 01/05/2006 08:31 +0600, Kev wrote:
> >>
> >> On Wed, 4 Jan 2006 07:25:25 -0800 (PST)
> >> "Scott Taylor" wrote:
> >>
> >> >
> >> > Kev said:
> >> > > im seting up a scrip pipe for postfix + spamassassin as a filter in
> >> > > postfix.
> >> > >
> >> > > this really works how ever i have a prb with the FWD depending on the
> >> > > recipent, can any one help me with this line
> >> > >
> >> > > if $EGREP -q -i "To: *kav@domain.net*" < /var/tempfs/out.$$
> >> > >
> >> > > how can i tell egrep to check for any format of To: in the email heder.
> >> >
> >> > You did. Perhaps something else in your query is blocking you, or maybe
> >> > you just want grep, it doesn't look like you are using "Extended Regex"
> >> > here.
> >> >
> >> > 'man grep' might be some more help to you.
> >>
> >> yeah i got it to work with the way i have put there, but the prb is that
> >> email addred comes as many formats like
> >>
> >> To: "Kev"
> >> To: Kev
> >> To:
> >> To: "Kev"
> >>
> >> etc etc.... so my above way dont work :(
>
> Something like:
>
> $EGREP -q -i '^To:.*'
>
> should do the job - note the couple of differences:
>
> ^ to match only at beginning of line
> .* to match any number of any character other than newline
> between To: and the e-mail address enclosed in brackets
>
> One subtle (?) bug in your original is that it says, roughly, "match
> the literal string "To:" followed by zero or more space characters
> followed by the literal string "kav@domain.ne" followed by zero or
> more 't' characters. In other words, "To:kav@domain.ne" would match,
> as would "To: kav@domain.nettttttttttttttttt"...
>
it works like a charm, thanks a lot
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html