Scrip Help

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 [at] 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 [at] orbitsl.net

if $EGREP -q -i "To: *kev [at] domain.net*" < /var/tempfs/out.$$
then

$SENDMAIL admin [at] domain.net < /var/tempfs/out.$$

else

$SENDMAIL spam [at] domain.net < /var/tempfs/out.$$

fi

else
$SENDMAIL "$ [at] " < /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 [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Kev [ Mi, 04 Januar 2006 10:09 ] [ ID #1126063 ]

Re: Scrip Help

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 [at] 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 [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Scott Taylor [ Mi, 04 Januar 2006 16:25 ] [ ID #1126064 ]

Re[2]: Scrip Help

On Wed, 4 Jan 2006 07:25:25 -0800 (PST)
"Scott Taylor" <scott [at] dctchambers.com> 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 [at] 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" <kev [at] domain.net>
To: Kev <kev [at] domain.net>
To: <kev [at] domain.net>
To: <kev [at] domain.net> "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 [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Kev [ Do, 05 Januar 2006 03:31 ] [ ID #1127802 ]

Re: Re[2]: Scrip Help

On 01/05/2006 08:31 +0600, Kev wrote:
>>
>> On Wed, 4 Jan 2006 07:25:25 -0800 (PST)
>> "Scott Taylor" <scott [at] dctchambers.com> 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 [at] 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" <kev [at] domain.net>
>> To: Kev <kev [at] domain.net>
>> To: <kev [at] domain.net>
>> To: <kev [at] domain.net> "Kev"
>>
>> etc etc.... so my above way dont work :(

Something like:

$EGREP -q -i '^To:.*<kav [at] domain.net>'

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 [at] domain.ne" followed by zero or
more 't' characters. In other words, "To:kav [at] domain.ne" would match,
as would "To: kav [at] domain.nettttttttttttttttt"...

tw



--
+--------------------------+------------------------------+
| Tim Walberg | twalberg [at] 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 [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Tim Walberg [ Do, 05 Januar 2006 04:18 ] [ ID #1127803 ]

Re[4]: Scrip Help

On Wed, 4 Jan 2006 21:18:54 -0600
Tim Walberg <twalberg [at] mindspring.com> wrote:

> On 01/05/2006 08:31 +0600, Kev wrote:
> >>
> >> On Wed, 4 Jan 2006 07:25:25 -0800 (PST)
> >> "Scott Taylor" <scott [at] dctchambers.com> 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 [at] 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" <kev [at] domain.net>
> >> To: Kev <kev [at] domain.net>
> >> To: <kev [at] domain.net>
> >> To: <kev [at] domain.net> "Kev"
> >>
> >> etc etc.... so my above way dont work :(
>
> Something like:
>
> $EGREP -q -i '^To:.*<kav [at] domain.net>'
>
> 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 [at] domain.ne" followed by zero or
> more 't' characters. In other words, "To:kav [at] domain.ne" would match,
> as would "To: kav [at] 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 [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Kev [ Do, 05 Januar 2006 05:27 ] [ ID #1127804 ]

Re[4]: Scrip Help

On Wed, 4 Jan 2006 21:18:54 -0600
Tim Walberg <twalberg [at] mindspring.com> wrote:

> On 01/05/2006 08:31 +0600, Kev wrote:
> >>
> >> On Wed, 4 Jan 2006 07:25:25 -0800 (PST)
> >> "Scott Taylor" <scott [at] dctchambers.com> 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 [at] 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" <kev [at] domain.net>
> >> To: Kev <kev [at] domain.net>
> >> To: <kev [at] domain.net>
> >> To: <kev [at] domain.net> "Kev"
> >>
> >> etc etc.... so my above way dont work :(
>
> Something like:
>
> $EGREP -q -i '^To:.*<kav [at] domain.net>'
>
> 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 [at] domain.ne" followed by zero or
> more 't' characters. In other words, "To:kav [at] domain.ne" would match,
> as would "To: kav [at] 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 [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Kev [ Do, 05 Januar 2006 10:20 ] [ ID #1127805 ]
Linux » gmane.linux.admin » Scrip Help

Vorheriges Thema: /dev/pts/n
Nächstes Thema: Logging root activity with syslog-ng