Re: [vox-tech] procmail question

2010-10-23 Thread Tony Cratz
On 10/23/2010 06:01 PM, Chanoch (Ken) Bloom wrote:
> A quick googling suggests it doesn't know how to do it in-process, but
> you could use the GNU mailutils pipe extension to do such things (in
> conjunction with a program like formail or reformail, or of course a
> spam filter like spamassassin). You can look in /usr/lib/mailutils/ to
> see what extensions are available, and you can write your own as a
> shared library.

Thanks for the additional info. This support what I thought I
was seeing. And at one time Procmail/formail was combine
together as src in a tar file. I'm not sure if this is still
the case.


>>  Maildrop was also mention, I only took a quick and dirty look
>>  at it. Can it also solve the above questions?
> 
> I don't actually use Sieve for my email. I suggested it because it was a
> standard.
> 
> I've used maildrop in the past (rewriting headers, and running spam
> filters with its xfilter command), and my mail filters looked like (for
> example)
> 
> if (/Mailing-List: list some.mailinglist.org 
> ; contact/:h ||\
> /From:.*...@bar.com/ || \
> /From:.*...@foo.com/ || \
> /From:.*...@bar.com/ || \
> /From:@some.domain.org/ || \
> /Mailing-List: list some-other-mailingl...@yahoogroups.com; / || \
> /From:.*afi...@email.org/ )
> {
>   to $MAILBOX/.util.probably-spam
> }
> 
> # spam filtering
> if ($SIZE < 1048576)
> {
>xfilter 'spamassassin'
> }
> 
> if (/^X-Spam-Status: Yes/)
> {
>xfilter 'reformail -I"Status: RO"'
>to '| $HOME/bin/maildir-deliverread $MAILBOX/.util.probably-spam'
> }
> 
> 
> I didn't like this (I didn't find it concise enough), and the
> backslashes as line continuations and mandatory braces annoyed me. (I
> was always forgetting them when I made changes, and it would break my
> email for days on end.)

And once again you supported what I thought I found in my
short research. I also find maildrop syntax to not be as
clear as what I would like. I also don't like having to
escape things when there really is no good reason for it.

I think there is is room for a new filter program. I have
thought of a syntax which might be more like a C program.
My thought was along the line of:

if ((header_to(name) == "" || header_to(name) != "Tony")
&& header_to(email) == "cr...@hematite.com" &&
(header_from(name) != "Tony" && header_from(email) ==
"cr...@hematite.com"))
{
log("Message not sent by Tony");
next; /* wait for next message */
} else {
if (header_get("X-tony-really-sent:") == "secret_key") {
log("tony sent this message")
save_message($Tonysent");
/* save in the tony sent mail box */
}
}


This is not fully flushed out but it gives an idea of kind
of what I was thinking. There would be a set of functions
which deals with the envelop, body and attachments. Such as:

Return a structure which contain char *real_name and
char *email_name

envelop_header_to()
envelop_header_from()
header_to()
header_from()

Return a char *value
header_messageid()
header_subject()

header_date_tm() - return a tm struct of the time
header_date_sec() - returns times in seconds

header_receive() - return array of structures of receive values

header_list() - return an array headers names (could be used
to see what headers are contained in messages.

header_get(matchstring) - return string value of header which
matches the match string.

$attach_num - number of attachment
$attach_size($num)
$body_size
$total_message_size

attachments($num) - return array of info about attachment
attach_scan($num, string) - matches string in attachment
(need to think more about this one)

body_text_html - returns if the body is plain text or html
body_html(string) - scans the html output for strings
body_html_code(string) - scan the html_code for string
body_text(string) - matchings string in body. Newlines are
converted to what space.

replace_header("To:", replacement_string)
mail_message($new_header_altered_message_with_body)


Again this is just the first pass of an idea. I think if the
syntax was correctly developed it would be clear to understand
and also be easy to implement Sieve style rules for filtering.

I'm not ready yet to say it is ready for development. It is
still early in the thought process. In the mean time, I think
I wi

Re: [vox-tech] procmail question

2010-10-23 Thread Chanoch (Ken) Bloom
On Sat, 2010-10-23 at 14:07 -0700, Tony Cratz wrote:

> On 10/21/2010 11:21 AM, Ken Bloom wrote:
> > That's why I suggested GNU mailutils. It has a "sieve" command that
> > looks like it's a standalone filter (procmail replacement).
> 
> 
>   I would like to come back to this and ask a question just
>   in case I did not see what I should have.
> 
>   Do you know if Sieve can rewrite headers. For example can I
>   change the To: header, or the Subject: header.


A quick googling suggests it doesn't know how to do it in-process, but
you could use the GNU mailutils pipe extension to do such things (in
conjunction with a program like formail or reformail, or of course a
spam filter like spamassassin). You can look in /usr/lib/mailutils/ to
see what extensions are available, and you can write your own as a
shared library.

> And if the
>   answer is yeas, then can I take the new message and send it
>   to my SMTP server (such as Sendmail) to redeliver the message
>   to the new list?



>   Maildrop was also mention, I only took a quick and dirty look
>   at it. Can it also solve the above questions?


I don't actually use Sieve for my email. I suggested it because it was a
standard.

I've used maildrop in the past (rewriting headers, and running spam
filters with its xfilter command), and my mail filters looked like (for
example)


if (/Mailing-List: list some.mailinglist.org; contact/:h || \
/From:.*...@bar.com/ || \
/From:.*...@foo.com/ || \
/From:.*...@bar.com/ || \
/From:@some.domain.org/ || \
/Mailing-List: list some-other-mailingl...@yahoogroups.com; / || \
/From:.*afi...@email.org/ )
{
  to $MAILBOX/.util.probably-spam
}

# spam filtering
if ($SIZE < 1048576)
{
   xfilter 'spamassassin'
}

if (/^X-Spam-Status: Yes/)
{
   xfilter 'reformail -I"Status: RO"'
   to '| $HOME/bin/maildir-deliverread $MAILBOX/.util.probably-spam'
}



I didn't like this (I didn't find it concise enough), and the
backslashes as line continuations and mandatory braces annoyed me. (I
was always forgetting them when I made changes, and it would break my
email for days on end.)

So I changed to a solution in Ruby. I tried Perl first, but Perl
performs variable interpolation with the @ sigil, so you can't put email
addresses in a regular expression in Perl without escaping them. You'll
notice that I don't bother to escape the period metacharacter in my
regular expressions. Though technically, it can match any character,
that possibility for false positives doesn't seem to matter much.

 First, here's the skeleton that you need to write your own version.
(You'll probably want to redefine the saveread function so that it
doesn't depend on an external script.)


#!/usr/bin/env ruby
require 'rfilter/delivery_agent'
class RFilter::DeliveryAgent

   def myfilter
  #RULES GO IN HERE
   end

   #SUPPORT CODE FOLLOWS
  

   def self.header_accessor name,field
  class_eval <<-"end;"
 def #{name}
header["#{field}"] || ""
 end
  end;
   end

   header_accessor :from, "From"
   header_accessor :to, "To"
   header_accessor :listid, "List-Id"
   header_accessor :spam, "X-Spam-Status"
   header_accessor :subject, "Subject"
   header_accessor :msgid, "Message-id"
   header_accessor :cc, "CC"

   def isto? pattern
 not [to,cc].grep(pattern).empty?
   end
   def involves? pattern
 not [from,to,cc].grep(pattern).empty?
   end

   def ignore mailbox
  saveread ".ignored-summer"
   end

   alias_method :internal_save, :save
   def saveto mailbox
  internal_save "#{ENV['HOME']}/Maildir/#{mailbox}/"
   end
   alias_method :save, :saveto

   def saveread mailbox
  pipe "#{ENV['HOME']}/bin/maildir-deliverread 
#{ENV['HOME']}/Maildir/#{mailbox}/"
   end

   def discard
  pipe "true"
   end

   def main
  myfilter
   end

end

begin
   RFilter::DeliveryAgent.process(STDIN,nil) { |agent| agent.main }
rescue RFilter::DeliveryAgent::DeliverySuccess
end


Then you can write really concise rules that look like this. (Any call
to a save function or discard function stops the filter right there.)


  discard if from =~ /nore...@studygroup.com/
  discard if from =~ /walgre...@email.walgreens.com/
  saveto ".computer" if header["Return-Path"] =

Re: [vox-tech] procmail question

2010-10-23 Thread Tony Cratz
On 10/21/2010 11:21 AM, Ken Bloom wrote:
> That's why I suggested GNU mailutils. It has a "sieve" command that
> looks like it's a standalone filter (procmail replacement).


I would like to come back to this and ask a question just
in case I did not see what I should have.

Do you know if Sieve can rewrite headers. For example can I
change the To: header, or the Subject: header. And if the
answer is yeas, then can I take the new message and send it
to my SMTP server (such as Sendmail) to redeliver the message
to the new list?

Maildrop was also mention, I only took a quick and dirty look
at it. Can it also solve the above questions?

The reason why I ask these questions, is this is part of the
power of Procmail. Not only can you filter messages to different
folders but you can change the headers and send the mail on.
I have done this for years with Procmail for a Science Fiction
group. I would tag the subject line (much like this message
subject line is tagged with [vox-tech], and I would send the
message to that years group of people. This allowed us to
maintain the same E-mail addresses over the years.

So before I continue to look at Sieve or Maildrop I would
like to have these questions answered. Otherwise I don't
consider either one as a true replacement for Procmail. I
can only consider them as a filter program.

Sorry for the delay in getting back to this topic. I had other
things going on the last day.

Tony
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] procmail question

2010-10-21 Thread Matthew Van Gundy
On 10/21/10 10:27 AM, Tony Cratz wrote:
>> I see some recipes that have the following on the first line.
>>
>> :0:
>
>   It should.
>
>   The rule ':0:' is used to not to continue on to the next rule
>   if there is a match on the test. So think of it as.
>

Actually, man 5 procmailrc states:

Local lockfile
If you put a second (trailing) ':' [as in :0:] on the first
recipe line, then procmail  will use a locallockfile (for this
recipe only).  You can optionally specify the locallockfile to
use; if you don't  however,  procmail will  use the destination
filename (or the filename following the first '>>') and will
append $LOCKEXT to it.

Thus, you should use :0: if you're delivering to a mailbox that cannot 
support concurrent deliveries by multiple processes (e.g. an mbox file). 
  You can use :0 if you're piping to an application, delivering to a 
Maildir, etc.

procmail stops processing your recipe file when it executes a delivering 
recipe where "delivering recipe" is defined as:

 Delivering recipes are those that cause header and/or body of the
 mail to  be:  written  into  a file, absorbed by a program or
 forwarded to a mailaddress.

You can cause a delivering recipe to considered non-delivering by using 
the 'c' (carbon copy) flag as in:

 :0 c
 ...

Cheers,
Matt
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] procmail question

2010-10-21 Thread Matthew Van Gundy
On 10/21/10 10:54 AM, Ken Bloom wrote:
> Yes, but people should be encouraged to use something with more sane
> syntax if possible. For example, sieve (from GNU mailutils) uses a
> standard syntax that is understood by many IMAP servers.

I understand that maildrop is another popular alternative.  Though, 
procmail syntax isn't too bad once you get used to it.

Cheers,
Matt

___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] procmail question

2010-10-21 Thread Matthew Van Gundy
On 10/21/10 9:59 AM, Brian Lavender wrote:
> Does this move the email to my mailbox IN.olpc-social if it is To: 
> olpc-soc...@googlegroups.com?
>
> :0
> * ^To:.*olpc-soc...@googlegroups.com
> IN.olpc-social

Yep.  But I might suggest:

:0:
* ^to_olpc-soc...@googlegroups.com
IN.olpc-social

Assuming IN.olpc-social is an mbox, the second ':' locks it during 
delivery.  And ^TO_ ...

 If the regular expression contains `^TO_' it will be substituted by
 `(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope
 |Apparently(-Resent)?)-To):(.*[^-a-zA-Z0-9_.])?)', which should
 catch all destination specifications containing a specific address.

Cheers,
Matt

___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] procmail question

2010-10-21 Thread Bill Kendrick
On Thu, Oct 21, 2010 at 12:37:08PM -0700, Tony Cratz wrote:
>   Not yet for me until after I have been able to fully understand
>   and get a working version for myself.

I figured.  (Of course, if anyone else out here knows much about Sieve
and wants to talk about it, speak up!)


>   As for Procmail, that I can show some examples for. I need to do
>   search my laptop and make sure I have the more complex version.

Cool, thanks.  Of course, we're booked up through June of next year
(though May is currently available), so you've still got time to become
a Sieve expert. ;)

Unless, of course, you (or whomever) just wants to do a short
mini-presenation.  (We sometimes do those, between intro & club business,
and the main speaker.)

Thx,

-bill!
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] procmail question

2010-10-21 Thread Tony Cratz
On 10/21/2010 12:33 PM, Bill Kendrick wrote:
> On Thu, Oct 21, 2010 at 12:14:40PM -0700, Tony Cratz wrote:
>> On 10/21/2010 11:21 AM, Ken Bloom wrote:
>>> That's why I suggested GNU mailutils. It has a "sieve" command that
>>> looks like it's a standalone filter (procmail replacement).
>>
>>  I'm doing some research now into Sieve. While the rules seem
>>  a bit cleaner and easier to understand I would like to see
>>  the syntax cleaned up a bit (but that is me).
> 
> I smell a talk topic. :)  Any takers?


Not yet for me until after I have been able to fully understand
and get a working version for myself.

As for Procmail, that I can show some examples for. I need to do
search my laptop and make sure I have the more complex version.


Tony
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] procmail question

2010-10-21 Thread Bill Kendrick
On Thu, Oct 21, 2010 at 12:14:40PM -0700, Tony Cratz wrote:
> On 10/21/2010 11:21 AM, Ken Bloom wrote:
> > That's why I suggested GNU mailutils. It has a "sieve" command that
> > looks like it's a standalone filter (procmail replacement).
> 
>   I'm doing some research now into Sieve. While the rules seem
>   a bit cleaner and easier to understand I would like to see
>   the syntax cleaned up a bit (but that is me).

I smell a talk topic. :)  Any takers?

-bill!
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] procmail question

2010-10-21 Thread Tony Cratz
Ken:

On 10/21/2010 11:21 AM, Ken Bloom wrote:
> That's why I suggested GNU mailutils. It has a "sieve" command that
> looks like it's a standalone filter (procmail replacement).

Thanks.

I'm doing some research now into Sieve. While the rules seem
a bit cleaner and easier to understand I would like to see
the syntax cleaned up a bit (but that is me).

I'm still in the process of doing my research. At some point
in the future I will likely make the change over to Sieve. It
will take me some time to reproduce the correct .procmailrc and
test it for a while. I should say my personal .procmailrc is
not as complex as another one I wrote which has procmail rules
inside of procmail rules (case statements within a case
statement).


Tony
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] procmail question

2010-10-21 Thread Ken Bloom
On Thu, 2010-10-21 at 11:13 -0700, Tony Cratz wrote:
> On 10/21/2010 10:54 AM, Ken Bloom wrote:
> > Yes, but people should be encouraged to use something with more sane
> > syntax if possible. For example, sieve (from GNU mailutils) uses a
> > standard syntax that is understood by many IMAP servers.
> 
> 
>   My question is, is there a stand alone package for Sieve? On
>   to replace Procmail so mail can be processed outside of a
>   mail client.

That's why I suggested GNU mailutils. It has a "sieve" command that
looks like it's a standalone filter (procmail replacement).

>   With Procmail you can take your mail box and run it through
>   Procmail to filter the messages into new MBOX files. This is
>   a very strong feature of Procmail which I have used a number of
>   times.
> 
>   I agree with you the Procmail rules syntax is the pits. Every
>   so often I look for a replacement and not found a stand-alone
>   program to replace it. I'm always open for suggestions. And if
>   you can point me to such a program which uses Sieve I would
>   really be happy as I want to replace Procmail.

--Ken

___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] procmail question

2010-10-21 Thread Tony Cratz
On 10/21/2010 10:54 AM, Ken Bloom wrote:
> Yes, but people should be encouraged to use something with more sane
> syntax if possible. For example, sieve (from GNU mailutils) uses a
> standard syntax that is understood by many IMAP servers.


My question is, is there a stand alone package for Sieve? On
to replace Procmail so mail can be processed outside of a
mail client.

With Procmail you can take your mail box and run it through
Procmail to filter the messages into new MBOX files. This is
a very strong feature of Procmail which I have used a number of
times.

I agree with you the Procmail rules syntax is the pits. Every
so often I look for a replacement and not found a stand-alone
program to replace it. I'm always open for suggestions. And if
you can point me to such a program which uses Sieve I would
really be happy as I want to replace Procmail.


Tony
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] procmail question

2010-10-21 Thread Brian Lavender
On Thu, Oct 21, 2010 at 12:54:50PM -0500, Ken Bloom wrote:
> On Thu, 2010-10-21 at 10:27 -0700, Tony Cratz wrote:
> > On 10/21/2010 09:59 AM, Brian Lavender wrote:
> > > Does this move the email to my mailbox IN.olpc-social if it is To: 
> > > olpc-soc...@googlegroups.com?
> > > 
> > > :0
> > > * ^To:.*olpc-soc...@googlegroups.com
> > > IN.olpc-social
[snip]
> > Speaking of procmail. From my understanding this project is
> > really no longer being maintained. But if you ask around it
> > is still being used. If someone is looking for a project for
> > school, Procmail could really use a rewrite.
> > 
> 
> Yes, but people should be encouraged to use something with more sane
> syntax if possible. For example, sieve (from GNU mailutils) uses a
> standard syntax that is understood by many IMAP servers.

I think I am going to start looking at sieve. I think I said this before.
Any suggested tutorials?

brian
-- 
Brian Lavender
http://www.brie.com/brian/

"Program testing can be used to show the presence of bugs, but never to
show their absence!"

Professor Edsger Dijkstra
1972 Turing award recipient
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] procmail question

2010-10-21 Thread Ken Bloom
On Thu, 2010-10-21 at 10:27 -0700, Tony Cratz wrote:
> On 10/21/2010 09:59 AM, Brian Lavender wrote:
> > Does this move the email to my mailbox IN.olpc-social if it is To: 
> > olpc-soc...@googlegroups.com?
> > 
> > :0
> > * ^To:.*olpc-soc...@googlegroups.com
> > IN.olpc-social
> > 
> > I see some recipes that have the following on the first line.
> > 
> > :0:
> 
> 
>   It should.
> 
>   The rule ':0:' is used to not to continue on to the next rule
>   if there is a match on the test. So think of it as.
> 
>   if {$TO_ADDRESS == "*olpc-soc...@googlegroup.com") {
>   save_to(olpc_social);
>   exit;
>   }
> 
>   if you use ":0" then it is test the next rule in your
>   .procmailrc file. Typical if you use a number of rules with
>   the ":0" format then the very last rule in your file would
>   be ":0:". Thank of it as the end of a large cast statement.
> 
> 
>   Speaking of procmail. From my understanding this project is
>   really no longer being maintained. But if you ask around it
>   is still being used. If someone is looking for a project for
>   school, Procmail could really use a rewrite.
> 

Yes, but people should be encouraged to use something with more sane
syntax if possible. For example, sieve (from GNU mailutils) uses a
standard syntax that is understood by many IMAP servers.

--Ken
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] procmail question

2010-10-21 Thread Tony Cratz
On 10/21/2010 09:59 AM, Brian Lavender wrote:
> Does this move the email to my mailbox IN.olpc-social if it is To: 
> olpc-soc...@googlegroups.com?
> 
> :0
> * ^To:.*olpc-soc...@googlegroups.com
> IN.olpc-social
> 
> I see some recipes that have the following on the first line.
> 
> :0:


It should.

The rule ':0:' is used to not to continue on to the next rule
if there is a match on the test. So think of it as.

if {$TO_ADDRESS == "*olpc-soc...@googlegroup.com") {
save_to(olpc_social);
exit;
}

if you use ":0" then it is test the next rule in your
.procmailrc file. Typical if you use a number of rules with
the ":0" format then the very last rule in your file would
be ":0:". Thank of it as the end of a large cast statement.


Speaking of procmail. From my understanding this project is
really no longer being maintained. But if you ask around it
is still being used. If someone is looking for a project for
school, Procmail could really use a rewrite.


Tony
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


[vox-tech] procmail question

2010-10-21 Thread Brian Lavender
Does this move the email to my mailbox IN.olpc-social if it is To: 
olpc-soc...@googlegroups.com?

:0
* ^To:.*olpc-soc...@googlegroups.com
IN.olpc-social

I see some recipes that have the following on the first line.

:0:

brian
-- 
Brian Lavender
http://www.brie.com/brian/

"Program testing can be used to show the presence of bugs, but never to
show their absence!"

Professor Edsger Dijkstra
1972 Turing award recipient
___
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


[vox-tech] procmail question: filtering message mangles headers

2004-10-15 Thread Henry House
I have the following procmail recipes to create a makeshift mailing list:

:0:
* ^To:.*m10-update
* !^X-Loop: [EMAIL PROTECTED]
* ^Received: from wotan.hajhouse.org   # accept messages from my host only
{
  :0c
  updates.mbox

  :0fh
  | sed -e 's/^Subject: /Subject: \[M-10\] /'

  :0
  ! `$HOME/_sendmails`
}

The first recipe in the bracketed block archives to a mailbox and the third
forwards the message to the list of addresses produced by the script
_sendmails.

The second recipe is supposed to tag the subject header of incoming messages to
make them easy for their recipients to identify, just a many mailing lists do.
It does not work! Instead the messages are mangled---the subject is completely
blank and the To: and From: headers are re-written. This does not happen when I
comment-out the second recipe.

Offhand, I see no reason for this difference in behavior either in the recipes
or in the logfile. Clearly I am missing some subtlety. Can anyone enlighten me?

-- 
Henry House
Please don't send me HTML mail! My mail system will reject it.
The unintelligible text that may follow is a digital signature.
See  to find out how to use it.
My OpenPGP key: .



signature.asc
Description: Digital signature
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech


Re: [vox-tech] procmail question: filtering ranges of IP's

2002-03-10 Thread Peter Jay Salzman

begin Jeff Newmiller <[EMAIL PROTECTED]> 
> On Sat, 9 Mar 2002, Peter Jay Salzman wrote:
> 
> [...]
> 
> > frankly i'd be happy to filter/spamcop any email coming from the range
> > of IP's 210.201.132.232 to 210.210.132.239.
> > 
> > question:
> > 
> > with procmail, how does one reliably match an IP address in the headers
> > which belongs to this range of IP's?
> 
> My guess would be

oh god.  how embarrasing.   sometimes we need friends to remind of us of
the obvious.  :)   thanks jeff.  

pete
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



Re: [vox-tech] procmail question: filtering ranges of IP's

2002-03-09 Thread Jeff Newmiller

On Sat, 9 Mar 2002, Peter Jay Salzman wrote:

[...]

> frankly i'd be happy to filter/spamcop any email coming from the range
> of IP's 210.201.132.232 to 210.210.132.239.
> 
> question:
> 
> with procmail, how does one reliably match an IP address in the headers
> which belongs to this range of IP's?

My guess would be

:0:
* ^Received:.*210\.2(0[0-9]|10)\.\d+\.\d+
/dev/null

---
Jeff NewmillerThe .   .  Go Live...
DCN:<[EMAIL PROTECTED]>Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...2k
---

___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



[vox-tech] procmail question: filtering ranges of IP's

2002-03-09 Thread Peter Jay Salzman

i got spam today at one of my ucd accounts.  here's the relevent header:

   Received: from server2000 (adsl-nk-A1051.hitron.net [210.201.178.35])
   by landau.ucdavis.edu

doing a whois on 210.201.178.35:

   inetnum: 210.201.132.232 - 210.210.132.239
   netname: GREATCBF-HT-AP
   descr:   Great Chinese Bills Finance Corporation
   descr:   F11, No.111, Ming-Sheng Rd., Kaohsiung City, Taiwan, R.O.C.
   country: TW
   changed: [EMAIL PROTECTED] 20010820
   source:  APNIC

frankly i'd be happy to filter/spamcop any email coming from the range
of IP's 210.201.132.232 to 210.210.132.239.

question:

with procmail, how does one reliably match an IP address in the headers
which belongs to this range of IP's?

pete
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



Re: [vox-tech] procmail question

2001-11-30 Thread Peter Jay Salzman

wow.  now i am truly embarrassed.  but grateful.  thanks, matt.

pete


begin: Matt Roper <[EMAIL PROTECTED]> quote
> I think it would be better to write your rule like this:
> 
> :0 c
> * !^From.*MAILER-DAEMON
> * !^From.*[EMAIL PROTECTED]
> * !^From.*vox.*-admin
> * !^Subject.*BOUNCE vox
> backup
> 
> Each rule is AND'd together, so a message will only go into your backup
> folder if each rule is true.  You don't want to OR the conditions
> together because then the only messages you are excluding from your
> backup folder are the ones that fail all the tests.
> 
> 
> Matt
> 
> On Thu, Nov 29, 2001 at 11:18:38AM -0800, Peter Jay Salzman wrote:
> > i have a few questions about procmail.  if you know any of them,
> > please feel free to jump in:
> > 
> ># make a backup
> >:0 c
> >* ! ^From.*MAILER-DAEMON   |  # don't backup error msgs
> >  ! ^From.*[EMAIL PROTECTED]  |  # don't backup spamcop msgs
> >  ! ^From.*vox.*-admin |  # don't backup admin requests
> >  ! ^Subject.*BOUNCE vox  # don't backup bounce msgs
> >backup
> > 
> > 
> > are lines continued automatically, or do i need an escape character
> > like "\"?
> > 
> > can comments go between conditionals like this?
> > 
> > any problems anyone can see with this?
> > 
> > thanks, pete
> > 
> > -- 
> > PGP Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
> > PGP Public Key:  finger [EMAIL PROTECTED]
> > ___
> > vox-tech mailing list
> > [EMAIL PROTECTED]
> > http://lists.lugod.org/mailman/listinfo/vox-tech
> 
> -- 
> 
> **
> * Matt Roper <[EMAIL PROTECTED]> *
> * http://www.mattrope.com*
> **
> ___
> vox-tech mailing list
> [EMAIL PROTECTED]
> http://lists.lugod.org/mailman/listinfo/vox-tech

-- 
PGP Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
PGP Public Key:  finger [EMAIL PROTECTED]
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



Re: [vox-tech] procmail question

2001-11-30 Thread Matt Roper

I think it would be better to write your rule like this:

:0 c
* !^From.*MAILER-DAEMON
* !^From.*[EMAIL PROTECTED]
* !^From.*vox.*-admin
* !^Subject.*BOUNCE vox
backup

Each rule is AND'd together, so a message will only go into your backup
folder if each rule is true.  You don't want to OR the conditions
together because then the only messages you are excluding from your
backup folder are the ones that fail all the tests.


Matt

On Thu, Nov 29, 2001 at 11:18:38AM -0800, Peter Jay Salzman wrote:
> i have a few questions about procmail.  if you know any of them,
> please feel free to jump in:
> 
># make a backup
>:0 c
>* ! ^From.*MAILER-DAEMON   |  # don't backup error msgs
>  ! ^From.*[EMAIL PROTECTED]  |  # don't backup spamcop msgs
>  ! ^From.*vox.*-admin |  # don't backup admin requests
>  ! ^Subject.*BOUNCE vox  # don't backup bounce msgs
>backup
> 
> 
> are lines continued automatically, or do i need an escape character
> like "\"?
> 
> can comments go between conditionals like this?
> 
> any problems anyone can see with this?
> 
> thanks, pete
> 
> -- 
> PGP Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
> PGP Public Key:  finger [EMAIL PROTECTED]
> ___
> vox-tech mailing list
> [EMAIL PROTECTED]
> http://lists.lugod.org/mailman/listinfo/vox-tech

-- 

**
* Matt Roper <[EMAIL PROTECTED]> *
* http://www.mattrope.com*
**
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



Re: [vox-tech] procmail question

2001-11-29 Thread Jeff Newmiller

On Thu, 29 Nov 2001, Peter Jay Salzman wrote:

> ok, i knew about man procmailrc, but not man procmailex.   after looking at
> it, i think this would work:
> 
> # make a backup
> :0 c
> * !^From.*MAILER-DAEMON.*$ \
> | !^Subject.*BOUNCE vox.*$ 
> backup
>
> better to your eyes?  doesn't look as pretty, but it's still not awful.
> the ".*$" should take care of spaces and comments finding their way into
> regexes...

I don't think ".*$" is doing anything useful.

I do think there should be a space between the "!" and the regex.

The problematic space would be the one between the "BOUNCE" and "vox", but
as long as you are positive that exactly one space is what you want to
match, then it should work.

I do not think you can put comments on the procmail lines, except on their
own.

Every conditional line must begin with a "*" character, and all
conditionals are "anded".

If you want "or" behavior, you have to build it into the regex.

I don't really claim to understand procmail syntax, except that I have
beaten odd lumps into my skull getting it to do what I wanted in the past
with enough dumb luck to get results I could live with. :P

I would try this:

# make a backup
:0 c
* ! ^(From.*MAILER-DAEMON|Subject.*BOUNCE vox) 
backup

> 
> pete
> 
> 
> begin: Ted Deppner <[EMAIL PROTECTED]> quote
> > On Thu, Nov 29, 2001 at 11:18:38AM -0800, Peter Jay Salzman wrote:
> > ># make a backup
> > >:0 c
> > >* ! ^From.*MAILER-DAEMON   |  # don't backup error msgs
> > >  ! ^Subject.*BOUNCE vox  # don't backup bounce msgs
> > >backup
> > > 
> > > are lines continued automatically, or do i need an escape character like "\"?
> > 
> > prolly, but you don't want a regex with all that whitespace.  
> > 
> > > can comments go between conditionals like this?
> > 
> > dunno for sure, but not really relevant given the last answer.
> > 
> > > any problems anyone can see with this?
> > 
> > man procmailex didn't show any snippets anywhere near that style.  I
> > didn't have time to read it in detail, but you might take a peek.  I think
> > the regex interpretation kills this whole style though.
> 
> -- 
> PGP Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
> PGP Public Key:  finger [EMAIL PROTECTED]
> ___
> vox-tech mailing list
> [EMAIL PROTECTED]
> http://lists.lugod.org/mailman/listinfo/vox-tech
> 

---
Jeff NewmillerThe .   .  Go Live...
DCN:<[EMAIL PROTECTED]>Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...2k
---

___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



Re: [vox-tech] procmail question

2001-11-29 Thread Peter Jay Salzman

ok, i knew about man procmailrc, but not man procmailex.   after looking at
it, i think this would work:

# make a backup
:0 c
* !^From.*MAILER-DAEMON.*$ \
| !^Subject.*BOUNCE vox.*$ 
backup


better to your eyes?  doesn't look as pretty, but it's still not awful.
the ".*$" should take care of spaces and comments finding their way into
regexes...

pete


begin: Ted Deppner <[EMAIL PROTECTED]> quote
> On Thu, Nov 29, 2001 at 11:18:38AM -0800, Peter Jay Salzman wrote:
> ># make a backup
> >:0 c
> >* ! ^From.*MAILER-DAEMON   |  # don't backup error msgs
> >  ! ^Subject.*BOUNCE vox  # don't backup bounce msgs
> >backup
> > 
> > are lines continued automatically, or do i need an escape character like "\"?
> 
> prolly, but you don't want a regex with all that whitespace.  
> 
> > can comments go between conditionals like this?
> 
> dunno for sure, but not really relevant given the last answer.
> 
> > any problems anyone can see with this?
> 
> man procmailex didn't show any snippets anywhere near that style.  I
> didn't have time to read it in detail, but you might take a peek.  I think
> the regex interpretation kills this whole style though.

-- 
PGP Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
PGP Public Key:  finger [EMAIL PROTECTED]
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



Re: [vox-tech] procmail question

2001-11-29 Thread Ted Deppner

On Thu, Nov 29, 2001 at 11:18:38AM -0800, Peter Jay Salzman wrote:
># make a backup
>:0 c
>* ! ^From.*MAILER-DAEMON   |  # don't backup error msgs
>  ! ^Subject.*BOUNCE vox  # don't backup bounce msgs
>backup
> 
> are lines continued automatically, or do i need an escape character like "\"?

prolly, but you don't want a regex with all that whitespace.  

> can comments go between conditionals like this?

dunno for sure, but not really relevant given the last answer.

> any problems anyone can see with this?

man procmailex didn't show any snippets anywhere near that style.  I
didn't have time to read it in detail, but you might take a peek.  I think
the regex interpretation kills this whole style though.

-- 
Ted Deppner
http://www.psyber.com/~ted/
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



[vox-tech] procmail question

2001-11-29 Thread Peter Jay Salzman

i have a few questions about procmail.  if you know any of them, please feel
free to jump in:

   # make a backup
   :0 c
   * ! ^From.*MAILER-DAEMON   |  # don't backup error msgs
 ! ^From.*[EMAIL PROTECTED]  |  # don't backup spamcop msgs
 ! ^From.*vox.*-admin |  # don't backup admin requests
 ! ^Subject.*BOUNCE vox  # don't backup bounce msgs
   backup


are lines continued automatically, or do i need an escape character like "\"?

can comments go between conditionals like this?

any problems anyone can see with this?

thanks,
pete

-- 
PGP Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
PGP Public Key:  finger [EMAIL PROTECTED]
___
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech



[vox-tech] procmail question - if/then sort of thing

2001-11-10 Thread Peter Jay Salzman

is there a way to do if/then constructs in procmail?   to get messages
about the PDC 700 from the gphoto mailing list, i need to do:

:0 H :
* ^Mailing-List: contact.*gphoto.*
* ^Subject:.*700.*
GPHOTO

:0 H :
* ^Mailing-List: contact.*gphoto.*
/dev/null

is there a way to combine these two recipes into a single recipe?

pete

-- 
"You may not use the Software in connection with any site that disparages
Microsoft, MSN, MSNBC, Expedia, or their products or services ..."
-- Clause from license for FrontPage 2002