linux-admin.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Scrip Help
@ 2006-01-04  9:09 Kev
  2006-01-04 15:25 ` Scott Taylor
  0 siblings, 1 reply; 6+ messages in thread
From: Kev @ 2006-01-04  9:09 UTC (permalink / raw)
  To: linux-admin

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Scrip Help
  2006-01-04  9:09 Scrip Help Kev
@ 2006-01-04 15:25 ` Scott Taylor
  2006-01-05  2:31   ` Re[2]: " Kev
  0 siblings, 1 reply; 6+ messages in thread
From: Scott Taylor @ 2006-01-04 15:25 UTC (permalink / raw)
  To: linux-admin


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re[2]: Scrip Help
  2006-01-04 15:25 ` Scott Taylor
@ 2006-01-05  2:31   ` Kev
  2006-01-05  3:18     ` Tim Walberg
  0 siblings, 1 reply; 6+ messages in thread
From: Kev @ 2006-01-05  2:31 UTC (permalink / raw)
  To: linux-admin


On Wed, 4 Jan 2006 07:25:25 -0800 (PST)
"Scott Taylor" <scott@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@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@domain.net>
To: Kev <kev@domain.net>
To: <kev@domain.net>
To: <kev@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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Re[2]: Scrip Help
  2006-01-05  2:31   ` Re[2]: " Kev
@ 2006-01-05  3:18     ` Tim Walberg
  2006-01-05  4:27       ` Re[4]: " Kev
  2006-01-05  9:20       ` Kev
  0 siblings, 2 replies; 6+ messages in thread
From: Tim Walberg @ 2006-01-05  3:18 UTC (permalink / raw)
  To: Kev; +Cc: linux-admin

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

Something like:

	$EGREP -q -i '^To:.*<kav@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@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      |                              |
+--------------------------+------------------------------+

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re[4]: Scrip Help
  2006-01-05  3:18     ` Tim Walberg
@ 2006-01-05  4:27       ` Kev
  2006-01-05  9:20       ` Kev
  1 sibling, 0 replies; 6+ messages in thread
From: Kev @ 2006-01-05  4:27 UTC (permalink / raw)
  To: linux-admin


On Wed, 4 Jan 2006 21:18:54 -0600
Tim Walberg <twalberg@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@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@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@domain.net>
> >>	To: Kev <kev@domain.net>
> >>	To: <kev@domain.net>
> >>	To: <kev@domain.net> "Kev"
> >>	
> >>	etc etc.... so my above way dont work :(
> 
> Something like:
> 
> 	$EGREP -q -i '^To:.*<kav@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@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....


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re[4]: Scrip Help
  2006-01-05  3:18     ` Tim Walberg
  2006-01-05  4:27       ` Re[4]: " Kev
@ 2006-01-05  9:20       ` Kev
  1 sibling, 0 replies; 6+ messages in thread
From: Kev @ 2006-01-05  9:20 UTC (permalink / raw)
  To: linux-admin


On Wed, 4 Jan 2006 21:18:54 -0600
Tim Walberg <twalberg@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@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@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@domain.net>
> >>	To: Kev <kev@domain.net>
> >>	To: <kev@domain.net>
> >>	To: <kev@domain.net> "Kev"
> >>	
> >>	etc etc.... so my above way dont work :(
> 
> Something like:
> 
> 	$EGREP -q -i '^To:.*<kav@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@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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-01-05  9:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-04  9:09 Scrip Help Kev
2006-01-04 15:25 ` Scott Taylor
2006-01-05  2:31   ` Re[2]: " Kev
2006-01-05  3:18     ` Tim Walberg
2006-01-05  4:27       ` Re[4]: " Kev
2006-01-05  9:20       ` Kev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).