Re: [Mailman-Users] regexp help

2009-11-04 Thread Savoy, Jim

Mark Sapiro wrote:

That would be the To: header of the reject notice.

Yes. That is the message I am analyzing.

Mailman sends a multipart/mixed message with two parts - a text/plain
part containing the reject reason and a message/rfc822 part containing
the post as received by Mailman. It is the message in this
message/rfc822 part that is what Mailman saw. If that is not the
original post, but somehow got wrapped by Exchange in the forwarding
process, you'll have to take that into account.

Got it. Under the message/rfc822 part, the To: header says
test.acco...@uleth.ca.

So in theory, it should accept this message. I will re-analyze
everything to
make sure there are no typos. Thanks.

 - jim -



--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help (OT: Edit and Mail)

2009-11-03 Thread Chr. von Stuckrad
On Mon, 02 Nov 2009, Savoy, Jim wrote:

 Depending on the options set in vi, it can do horrible things to
 indentation when you paste things in :(

:-) seen that!  Therefore modern vims have :set pasteenter
and as long as you not 'set nopaste' *no* munging of pastes will be
done! I'm needing/using that all the time, I might even put it
into my '.vimrc' and make it default ...

 I just looked at your original posting (using Outlook) and line 3 is
 not indented, but rather continuous from line 2, and the other indents
 are in columns 5 and 9 (not 4 and 8). I shall try viewing it with other
 mail clients, just for kicks.

'outlook' is a insert favorite expletive here for programmers.
By Default it *reformats* everything to 'Paragraphs' of the form:
- everything NOT split by an empty line is 'supposed to be a useless
linebreak for mailtransfer', then it collects all those lines and
reformats the resulting words with single whitespaces to window-size.
- an empty line means 'paragraph end', so itself may vanish anyway
only the linebreak in a paragraph stays.

It's like Microsoft(office)Word's view of Text and you are supposed
to write html or rtf anyway :-)

If hints(warnings, whatever) are on, you'll see a line above your
munged mail, saying it removed useless newlines, and by clicking
it you can get them back. 

Stucki
--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-11-03 Thread Mark Sapiro
Savoy, Jim wrote:

Mark Sapiro wrote:

Did you put 'Foo' back in the GLOBAL_PIPELINE prior to 'Moderate' and
restart Mailman?

I did.

What happens when you mail to test.account? Is the mail rejected by
Mailman? Does the To: header in the mail in the reject notice contain
'test.account'?

Yes, it is rejected. And the To: header does not come from test.account
but rather from the actual sender.


That would be the To: header of the reject notice.


Inside of what looks like an Exchange
attachment, I can see the full original message, with the To: header
displaying test.account. So it looks like the Exchange server may be
wrapping up the original message and obscuring the headers.


Mailman sends a multipart/mixed message with two parts - a text/plain
part containing the reject reason and a message/rfc822 part containing
the post as received by Mailman. It is the message in this
message/rfc822 part that is what Mailman saw. If that is not the
original post, but somehow got wrapped by Exchange in the forwarding
process, you'll have to take that into account.


-- 
Mark Sapiro m...@msapiro.netThe highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-11-03 Thread Savoy, Jim

Mark Sapiro wrote:

Did you put 'Foo' back in the GLOBAL_PIPELINE prior to 'Moderate' and
restart Mailman?

I did.

What happens when you mail to test.account? Is the mail rejected by
Mailman? Does the To: header in the mail in the reject notice contain
'test.account'?

Yes, it is rejected. And the To: header does not come from test.account
but rather from the actual sender. Inside of what looks like an Exchange
attachment, I can see the full original message, with the To: header
displaying test.account. So it looks like the Exchange server may be
wrapping up the original message and obscuring the headers.


Since that regexp 'test.account' is not anchored and is searched for by
the re.search() method, it means if the string 'test' in any
combination of upper/lower case followed by any single character (the
. matches any character) followed by the string 'account' in any
combination of upper/lower case is in the To: header, it will match.

OK - that's close enough for me. I don't really need to be that specific
anyway because my test.account (not the real name of the account) is
quite
a unique and unusual name.

I have just received word from the owners of this list that they no
longer
care about me doing this (they have just opened the list up to anyone)
so I probably won't spend too much more time on it now, especially if
the Exchange server (which I don't have access to) is obscuring the
original
headers from Mailman. Since we have exim as a front-end to Mailman, I
can
probably just do some sort of a re-write in there instead.

But thanks anyway. It was an interesting foray into Python for me!

 - jim -


--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-11-03 Thread Mark Sapiro
Savoy, Jim wrote:

Hi Mark,

   I got it to compile properly, but it is still not working.
I made the following changes in Foo.py:

import re
cre = re.compile('test.account', re.IGNORECASE)
def process(mlist, msg, msgdata):
if mlist.internal_name  'abc-l':
return
if cre.search(msg.get('to', '')):
msgdata['approved'] = 1
# Used by the Emergency module
msgdata['adminapproved'] = 1


Goal: The account test.acco...@uleth.ca is set to forward mail to the
mailing
list ab...@uleth.ca, which should accept it, regardless of who sent it
to
test.acco...@uleth.ca (all other mail to this list from non-members will
be
rejected).


Did you put 'Foo' back in the GLOBAL_PIPELINE prior to 'Moderate' and
restart Mailman?

What happens when you mail to test.account? Is the mail rejected by
Mailman? Does the To: header in the mail in the reject notice contain
'test.account'?


You also wrote:

if the contents of the To: header of the message matches the regexp in
re.compile() case insensitively, then the approved and adminapproved
flags will be set in the message metadata and the message won't be
subject to any holds.

So when you say matches the regexp do you mean exactly matches? And
if so,
would your regexp work?


Since that regexp 'test.account' is not anchored and is searched for by
the re.search() method, it means if the string 'test' in any
combination of upper/lower case followed by any single character (the
. matches any character) followed by the string 'account' in any
combination of upper/lower case is in the To: header, it will match.


Or do I need a more specific or accompanying
regexp in
the re.compile statement? eg

cre = re.compile('test.acco...@uleth.ca', re.IGNORECASE)


You could do that, or even 'test\.acco...@uleth\.ca' or other, even
more restrictive tests on the To: header, but what are the chances of
some mail being delivered to the abc-l list from a non-member with
'test.account' somewhere in the To: header, if it wasn't sent to the
proper test.acco...@uleth.ca address?

Some non-list member could mail

To: ab...@..., my-test-acco...@example.com

and the regexp 'test.account' would accept that mail. If you're
concerned about this, you could use a regexp like

  '(^|[\s])test\.acco...@uleth\.ca($|[\s])'

to require the exact address test.acco...@uleth.ca delimited by white
space, angle brackets or the start and end of the string, but there
are probably better ways of doing this such as using email utilities
to parse the To: header for all addresses and then testing to see that
'test.acco...@uleth.ca' is there and 'ab...@...' is not, but all that
seems unnecessary unless you're going to look at Received: headers too.

I.e., if I'm trying to fool you, I can always create a message To:
test.acco...@uleth.ca and send it directly to the abc-l list.

-- 
Mark Sapiro m...@msapiro.netThe highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-11-03 Thread Savoy, Jim
Hi Mark,

   I got it to compile properly, but it is still not working.
I made the following changes in Foo.py:

import re
cre = re.compile('test.account', re.IGNORECASE)
def process(mlist, msg, msgdata):
if mlist.internal_name  'abc-l':
return
if cre.search(msg.get('to', '')):
msgdata['approved'] = 1
# Used by the Emergency module
msgdata['adminapproved'] = 1


Goal: The account test.acco...@uleth.ca is set to forward mail to the
mailing
list ab...@uleth.ca, which should accept it, regardless of who sent it
to
test.acco...@uleth.ca (all other mail to this list from non-members will
be
rejected).


You also wrote:

if the contents of the To: header of the message matches the regexp in
re.compile() case insensitively, then the approved and adminapproved
flags will be set in the message metadata and the message won't be
subject to any holds.

So when you say matches the regexp do you mean exactly matches? And
if so,
would your regexp work? Or do I need a more specific or accompanying
regexp in
the re.compile statement? eg

cre = re.compile('test.acco...@uleth.ca', re.IGNORECASE)

Thanks.

 - jim -

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-11-02 Thread Savoy, Jim
Mark Sapiro wrote:

What you need is a custom handler. See the FAQ at
http://wiki.list.org/x/l4A9 for how to install one.

Thank you. Done.

In your case, the handler is very simple - just 9 lines.

import re
cre = re.compile('unique\.name', re.IGNORECASE)
def process(mlist, msg, msgdata):
if mlist.internal_name  'abc-l':
return
if cre.search(msg.get('to', '')):
msgdata['approved'] = 1
# Used by the Emergency module
msgdata['adminapproved'] = 1

Of course, you adjust the regexp 'unique\.name' and the list name
'abc-l' to suit. The handler needs to be in the pipeline before
Moderate.

OK - I made a file called Foo.py and put it in /Mailman/Handlers.
I then inserted this module right before 'Moderate' in the pipeline (I
editted
Defaults.py for this - just as a temporary measure to see if it would
work).
I will remove this and add a line to mm_cfg.py later.

I then stopped/started the Mailman processes (not sure if that's
necessary, but 
I did it anyway). Now the test email I sent is stuck in the shunt queue
and this
is in the errors log:

File /Mailman/Handlers/Foo.py, line 2
 cre = re.compile('unique\.name', re.IGNORECASE) def process(mlist,
msg, msgdata):
   ^
 SyntaxError: invalid syntax


It didn't line up well in this email message, but the carat (^) is
positioned
under the 'f' in the def.

I know diddly about Python (and not that much more about Mailman,
really) so I'm not
sure how to fix the problem. Any ideas? Thanks!

 - jim -

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-11-02 Thread Savoy, Jim
I also just noticed that the shunt queue started to fill up with
messages
for other lists as well, so I quickly removed the line I had inserted
into
Defaults.py, stopped/started the Mailman processes, and successfully
unshunted
everything. I was hoping the code would only affect the one list I am
messing
with, but I guess if there is a syntax error in it, it breaks the entire
pipeline (maybe).

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-11-02 Thread Savoy, Jim
I also just noticed that all of the other handlers have an accompanying
.pyc file, but my Foo.py does not. Perhaps that 'c' stands for
compiled
and I was supposed to compile the code first? (probably seems obvious to
someone familiar with Mailman/Python).
--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-11-02 Thread Geoff Shang

On Mon, 2 Nov 2009, Savoy, Jim wrote:


I also just noticed that all of the other handlers have an accompanying
.pyc file, but my Foo.py does not. Perhaps that 'c' stands for
compiled


It does.


and I was supposed to compile the code first? (probably seems obvious to
someone familiar with Mailman/Python).


No.  The code is automatically compiled if there is no pyc file or the py 
file is different.


Presumably there's no pyc file because of your syntax error.  At a guess, 
I'd say that the def statement should be on a new line, but I'm not a 
Python expert.


Geoff.

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-11-02 Thread Mark Sapiro
Savoy, Jim wrote:

Mark Sapiro wrote:

What you need is a custom handler. See the FAQ at
http://wiki.list.org/x/l4A9 for how to install one.

Thank you. Done.

In your case, the handler is very simple - just 9 lines.

import re
cre = re.compile('unique\.name', re.IGNORECASE)
def process(mlist, msg, msgdata):
if mlist.internal_name  'abc-l':
return
if cre.search(msg.get('to', '')):
msgdata['approved'] = 1
# Used by the Emergency module
msgdata['adminapproved'] = 1

Of course, you adjust the regexp 'unique\.name' and the list name
'abc-l' to suit. The handler needs to be in the pipeline before
Moderate.

OK - I made a file called Foo.py and put it in /Mailman/Handlers.
I then inserted this module right before 'Moderate' in the pipeline (I
editted
Defaults.py for this - just as a temporary measure to see if it would
work).
I will remove this and add a line to mm_cfg.py later.

I then stopped/started the Mailman processes (not sure if that's
necessary, but 
I did it anyway). Now the test email I sent is stuck in the shunt queue
and this
is in the errors log:

File /Mailman/Handlers/Foo.py, line 2
 cre = re.compile('unique\.name', re.IGNORECASE) def process(mlist,
msg, msgdata):
   ^
 SyntaxError: invalid syntax


You used some kind of word processor to create foo.py that concatenated
lines 2 and 3 into a single line. Your Foo.py file must be just like
my original example with lines 1, 2 and 3 at the left margin, lines 4
and 6 indented 4 spaces and lines 5, 7, 8 and 9 indented 8 spaces.

-- 
Mark Sapiro m...@msapiro.netThe highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-11-02 Thread Mark Sapiro
Savoy, Jim wrote:

I also just noticed that the shunt queue started to fill up with
messages
for other lists as well, so I quickly removed the line I had inserted
into
Defaults.py, stopped/started the Mailman processes, and successfully
unshunted
everything. I was hoping the code would only affect the one list I am
messing
with, but I guess if there is a syntax error in it, it breaks the entire
pipeline (maybe).


Because your handler is in the GLOBAL_PIPELINE and it has a syntax
error, every message encounters the SyntaxError exception and the
message is shunted.

-- 
Mark Sapiro m...@msapiro.netThe highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-11-02 Thread Savoy, Jim
Mark Sapiro wrote:

You used some kind of word processor to create foo.py that concatenated
lines 2 and 3 into a single line. Your Foo.py file must be just like
my original example with lines 1, 2 and 3 at the left margin, lines 4
and 6 indented 4 spaces and lines 5, 7, 8 and 9 indented 8 spaces.

These words you are saying are all true. I just cut your code in
Outlook and pasted it in vi. I will try it again with the indenting
you suggested (reminds me of Fortran!). Thanks.

 - jim -
 
--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-11-02 Thread Mark Sapiro
Savoy, Jim wrote:

You used some kind of word processor to create foo.py that concatenated
lines 2 and 3 into a single line. Your Foo.py file must be just like
my original example with lines 1, 2 and 3 at the left margin, lines 4
and 6 indented 4 spaces and lines 5, 7, 8 and 9 indented 8 spaces.

These words you are saying are all true. I just cut your code in
Outlook and pasted it in vi. I will try it again with the indenting
you suggested (reminds me of Fortran!). Thanks.


Depending on the options set in vi, it can do horrible things to
indentation when you paste things in :(

Python is not at all like Fortran, In Fortran (at least through Fortran
IV - I never did much with Fortran 77 and nothing beyond that) white
space except for line endings is totally insignificant. True, you have
some formatting restrictions like positions 1 - 5 for statement
numbers, 6 for continuation and 7 - 72 for statements (although some
compilers relaxed these), but consider that the compiler's
parser/tokenizer doesn't know whether

  do 5 i = 1, 10

is a do loop or an assignment to a variable named do5i until it gets to
the comma.

In Python, whitespace is of utmost significance. You either love it or
hate it, but block structure is based entirely on indentation.

-- 
Mark Sapiro m...@msapiro.netThe highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-11-02 Thread Savoy, Jim
Depending on the options set in vi, it can do horrible things to
indentation when you paste things in :(

I just looked at your original posting (using Outlook) and line 3 is
not indented, but rather continuous from line 2, and the other indents
are in columns 5 and 9 (not 4 and 8). I shall try viewing it with other
mail clients, just for kicks.

But now that I know that whitespace is critical in Python, I will be
more
careful.


Python is not at all like Fortran, In Fortran (at least through Fortran
IV - I never did much with Fortran 77 and nothing beyond that) white
space except for line endings is totally insignificant. True, you have
some formatting restrictions like positions 1 - 5 for statement numbers,
6 for continuation and 7 - 72 for statements (although some compilers
relaxed these), but consider that the compiler's parser/tokenizer
doesn't know whether

I was loosely referring to Fortran reserving certain columns for certain
things. I barely remember it at all (that was back in my pre-Commodore64
(PEEKin' and POKEin' anyone?), punched-hole card days).

 - jim -



--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-11-02 Thread Mark Sapiro
I just looked at your original posting (using Outlook) and line 3 is
not indented, but rather continuous from line 2, and the other indents
are in columns 5 and 9 (not 4 and 8). I shall try viewing it with other
mail clients, just for kicks. Right - column 5 IS indented 4 spaces from 
column 1 and column 9 is indented 8 spaces from column 1 which is what I 
meant. And line 3 should not be indented, but also not be joined to the end of 
line 2 which is apparently the only real problem with your file.


Look at my original in the archive at
http://mail.python.org/pipermail/mailman-users/2009-October/067496.html
or even as quoted in your reply at
http://mail.python.org/pipermail/mailman-users/2009-November/067555.html.

Both of those show proper formatting. I guess that's just one more
thing we can't trust Outlook to do.

BTW, indentation in steps of 4 is only a convention, it isn't
mandatory. The indentation could be 1 space and 2 spaces or 1 tab and
2 tabs or even 4 spaces and 1 tab, although mixing spaces and tabs is
dangerous and highly frowned upon. However, in any case, the highest
level (the first 3 lines in the example) must not be indented at all.

-- 
Mark Sapiro m...@msapiro.netThe highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


[Mailman-Users] regexp help

2009-10-21 Thread Savoy, Jim
Sorry to break the thread on this (my previous message didn't go
through, so I guess this

list is being moderated now).

 

Anyway, just wanted to say that I fixed my regexp problem. I am running
an older version

of Mailman, so tried this instead:

 

  \nfrom:.*unique.name

 

and it worked!

 

-  jim -

-   

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


[Mailman-Users] regexp help

2009-10-21 Thread Savoy, Jim
Hi all - I am trying to have all of the mail sent to a certain email
account automatically forwarded

to a moderated mailing list (moderated to everyone accept the mail from
this particular email

account). So I created the account (we'll call it
unique.n...@some.domain) and set up the mailing

list (we'll call it ab...@some.domain).

 

The only way I can think of getting the mailing list to accept the
forwarded mail is to use the spam

filters under [Privacy Options]. I create a new Spam Filter Rule like
so:

 

 /^.*unique.name.*$/

 

(I will make this more specific later)

 

But that doesn't seem to work. Mail sent to unique.n...@some.domain
returns the error message

you are not allowed to post to this mailing list to the original
sender. I assumed that unique.name

would be somewhere in the email headers, which is what the Spam rules
are filtering on, right?

 

Any ideas what I am doing wrong?

 

Thanks.

 

-  jim -

-   

 

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-10-21 Thread Savoy, Jim
I wrote:

Anyway, just wanted to say that I fixed my regexp problem. I am running
an older version of Mailman, so tried this instead:

  \nfrom:.*unique.name

and it worked!


Looks like I spoke to soon. It actually did not work. I have also tried
\n.*unique.name and that failed as well (I assumed that would just
compare
to all of the headers, as I am not sure if from was the one I should
be
looking at). Any ideas? (I am running mailman 2.1.5 still).

 - jim -

 
--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-10-21 Thread Savoy, Jim
Jim, try
from: .*@(?!.*uleth.ca)

The 'anything before the @ sign' is obvious, but the '?!.*' is to test 
for possible machine names, in case they're there.

Nope. That failed. I added a \n to the front of this and that failed
as well. I didn't think I would have to make any accommodations for the
machine names though because I have given this account a very unique
name, so my goal here is just to accept the mail if that unique.name is
found in any header at all. This is why I was sure that:

\n.*unique.name

would be good enough. But it was not. I probably don't really understand
what this filter is looking for though...

 - jim -





--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-10-21 Thread George Booth
Why don't you just add the email account to the list, set it for no mail,
and set it so it's unmoderated? 

 -Original Message-
 From: mailman-users-bounces+g.booth=usm@python.org 
 [mailto:mailman-users-bounces+g.booth=usm@python.org] On 
 Behalf Of Savoy, Jim
 Sent: Wednesday, October 21, 2009 11:24 AM
 To: mailman-users@python.org
 Subject: [Mailman-Users] regexp help
 
 Hi all - I am trying to have all of the mail sent to a certain email
 account automatically forwarded
 
 to a moderated mailing list (moderated to everyone accept the 
 mail from
 this particular email
 
 account). So I created the account (we'll call it
 unique.n...@some.domain) and set up the mailing
 
 list (we'll call it ab...@some.domain).
 
  
 
 The only way I can think of getting the mailing list to accept the
 forwarded mail is to use the spam
 
 filters under [Privacy Options]. I create a new Spam Filter Rule like
 so:
 
  
 
  /^.*unique.name.*$/
 
  
 
 (I will make this more specific later)
 
  
 
 But that doesn't seem to work. Mail sent to unique.n...@some.domain
 returns the error message
 
 you are not allowed to post to this mailing list to the original
 sender. I assumed that unique.name
 
 would be somewhere in the email headers, which is what the Spam rules
 are filtering on, right?
 
  
 
 Any ideas what I am doing wrong?
 
  
 
 Thanks.
 
  
 
 -  jim -
 
 -   
 
  
 
 --
 Mailman-Users mailing list Mailman-Users@python.org
 http://mail.python.org/mailman/listinfo/mailman-users
 Mailman FAQ: http://wiki.list.org/x/AgA3
 Security Policy: http://wiki.list.org/x/QIA9
 Searchable Archives: 
 http://www.mail-archive.com/mailman-users%40python.org/
 Unsubscribe: 
 http://mail.python.org/mailman/options/mailman-users/g.booth%4
 0usm.edu

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-10-21 Thread Savoy, Jim
George Booth wrote:

Why don't you just add the email account to the list, set it for no
mail,
and set it so it's unmoderated? 

Well that was the first thing I did, but that didn't work because the
mail
is not technically coming from that account. It's coming from whoever
originally
sent it (the unique.name account just forwards). That is why I thought I
could
try to circumvent it by using the spam filter to just search all of the
headers for an occurance of unique.name.

 - jim -

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-10-21 Thread Savoy, Jim
I looked at one of the actual headers (I am not posting the actual name
I am using as we don't want anyone to mail to it just yet!) but it
looked
like this:

To: Name, Unique unique.n...@uleth.ca

Since there is a dot in the username, I thought maybe that was fouling
up
the regular expression, so I tried all of these:

\nto: .*unique\.name
to: .*unique\.name
to: .*unique


to no avail...

 - jim -

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-10-21 Thread Savoy, Jim
CNulk writes:

Hi Jim,

I may be completely wrong (heck, wouldn't be the first time), but why
not have your unique.name address be an alias to a simple
bash/perl/etc. script which simply accepts the email message, rewrites
the message to be from the unique.name address, and sends it on to the
list.  When the list sees the message, it will appear to be from
unique.name and the standard mailman moderation and message acceptance
rules would apply.  I had to do something similar for a different email
distribution package to get around a software limitation.  It should
work unless you really need the from address to be from the actual
sender.

Yep - I could do that. Have exim rewrite the headers before it sends out
the message, but the people on the mailing list do want to know who the
email originally came from. They just don't want everyone to have access
to their mailing list, just this one account (an inquiries-type of
account).

I just re-read Mark's comments, and he says:

---
So assuming that what you want is to bypass the other
header_filter_rules, you need to add new item before the current rule
1 so the new rule becomes #1. Then the new rule 1 regexp should be

  ^from:.*(\s|)some\.person\.n...@gmail\.com(\s||$)

and the action Accept.
---

and that is exactly what I want to do - bypass the header_filter_rules.
But I am
afraid I don't quite understand this advice, Mark. How can I make this
spam rule
supercede other rules (like the one that says the list is moderated).
There
is no add new item button when you haven't got any spam rules. That
only
comes up when after I create me first rule, which is not superceding the
moderation
rule.

I should probably not say anything else until Mark logs in. He's
probably looking at
this huge chain and wanting to crack our skulls together like Moe.

 - jim -
 
--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-10-21 Thread Geoff Shang

On Wed, 21 Oct 2009, Savoy, Jim wrote:


Yep - I could do that. Have exim rewrite the headers before it sends out
the message, but the people on the mailing list do want to know who the
email originally came from. They just don't want everyone to have access
to their mailing list, just this one account (an inquiries-type of
account).


Ok, maybe I'm missing the point here.  couldn't you just allow all 
non-member postings and manually approve subscriptions?  Define the 
address as an alternate name for the list if you really don't want to give 
out the list address.


On one site I administer, we've converted our simple Email forwarder 
public Email address to a mailing list, with the project managers as the 
ownly subscribers.  Apart from the odd bit of fun we have with Reply-to, 
it works pretty well.  It helps to fascilitate discussion between the 
managers and encourages managers to copy everyone else on messages sent 
back to people outside the project.


Geoff.

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] regexp help

2009-10-21 Thread Mark Sapiro
Savoy, Jim wrote:

I just re-read Mark's comments, and he says:

---
So assuming that what you want is to bypass the other
header_filter_rules, you need to add new item before the current rule
1 so the new rule becomes #1. Then the new rule 1 regexp should be

  ^from:.*(\s|)some\.person\.n...@gmail\.com(\s||$)

and the action Accept.
---

and that is exactly what I want to do - bypass the header_filter_rules.


No, that is not what you want to do. What you want to do is bypass
other non-header_filter_rules holds (i.e. post from non-member) with a
header_filter_rule. You can't do that.

You can do it with accept_these_nonmembers, but not in your case,
because accept_these_nonmembers only works on the From: (or other
'sender' header, not on the To:.


But I am
afraid I don't quite understand this advice, Mark. How can I make this
spam rule
supercede other rules (like the one that says the list is moderated).


You can't.


There
is no add new item button when you haven't got any spam rules. That
only
comes up when after I create me first rule, which is not superceding the
moderation
rule.

I should probably not say anything else until Mark logs in. He's
probably looking at
this huge chain and wanting to crack our skulls together like Moe.


It's not your thread - it's the two week backlog of just approved
posts. :)

What you need is a custom handler. See the FAQ at
http://wiki.list.org/x/l4A9 for how to install one. In your case,
the handler is very simple - just 9 lines.

import re
cre = re.compile('unique\.name', re.IGNORECASE)
def process(mlist, msg, msgdata):
if mlist.internal_name  'abc-l':
return
if cre.search(msg.get('to', '')):
msgdata['approved'] = 1
# Used by the Emergency module
msgdata['adminapproved'] = 1


Of course, you adjust the regexp 'unique\.name' and the list name
'abc-l' to suit. The handler needs to be in the pipeline before
Moderate.

If you make a list specific pipeline for just this list, you can leave
out the

if mlist.internal_name  'abc-l':
return

What this does is nothing if the list isn't abc-l. If it is abc-l and
if the contents of the To: header of the message matches the regexp in
re.compile() case insensitively, then the approved and adminapproved
flags will be set in the message metadata and the message won't be
subject to any holds.

-- 
Mark Sapiro m...@msapiro.netThe highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] Regexp help - Matching Subjects to Hold Posts in Mailman 2.0.11

2005-05-31 Thread Jim Tittsler
On May 31, 2005, at 14:44, David Powell wrote:

 One line has a tab b/w : and [SPAM, another a space and the third
 nothing.  The other thing I wasn't sure about was if the first  
 letter of
 subject is uppper case or not.

If you are putting these in 2.0.x's bounce_matching_headers list  
variable, it doesn't matter.  Mailman takes the thing before the  
colon and its trailing whitespace (tabs or spaces) as the header  
field name to look for and the remainder of the line as the regular  
expression to compare against.  (Which explains the comment in the  
description that unescaped leading whitespace is stripped from the  
regex... not that it affects your case.)

(For the test cases where you didn't have whitespace separating the  
subject: and the regex, I'm surprised that you didn't get error  
messages logged in your Mailman config log.)

subject: \[SPAM
worked for me on an old 2.0.13 Mailman.  (I don't have a 2.0.11  
version to play with, but a really quick check of the CVS log  
suggests there were no relevant changes between those versions.)  If  
you want to track down where its going wrong on your machine, you  
could sprinkle some syslog() calls in Mailman/MailList.py's  
parse_matching_header_opt() and HasMatchingHeader().

-- 
Jim Tittsler http://www.OnJapan.net/  GPG: 0x01159DB6
Python Starship  http://Starship.Python.net/crew/jwt/
Mailman IRC  irc://irc.freenode.net/#mailman


--
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=showamp;file=faq01.027.htp


[Mailman-Users] Regexp help - Matching Subjects to Hold Posts in Mailman 2.0.11

2005-05-30 Thread David Powell (YANQ)
Hi All,

I've only recently discovered the world of regexps, so please bare with
me.  What I want to do is block messages whose subject starts with [SPAM.

Mail to my server goes through spamassassin first - it alters mail that
it thinks is spam by adding [SPAM xx.xx] to the start of the subject.
What I'd like to do is get mailman to just automatically drop these
messages.

An example subject is something like this:

Subject:[SPAM 07.49] Stop your computer from crashing, guaranteed!

(btw, I've just copied and pasted this from mailmans administratrive
requests page - there is a tab b/w the colon and the [ open bracket).

Here are the different regexp's that I've tried, none seem to work.

subject: .*\[SPAM*
subject:.*\[SPAM*
subject: .*[SPAM*
subject:.*[SPAM*

subject:*\[SPAM*
subject: *\[SPAM*
subject:\[SPAM*
subject: \[SPAM*

subject: [SPAM*
subject: *[SPAM*
subject:[SPAM*
subject:*[SPAM*

what am I doing wrong??

TIA

David


--
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=showamp;file=faq01.027.htp


Re: [Mailman-Users] Regexp help - Matching Subjects to Hold Posts in Mailman 2.0.11

2005-05-30 Thread Stephen J. Turnbull
 David == David Powell (YANQ) [EMAIL PROTECTED] writes:

Life will be much easier for this kind of task if you upgrade to
Mailman 2.1.x; 2.1.6 is current.

David Here are the different regexp's that I've tried, none seem
David to work.

Really, you should invest in Jeffrey Friedl's book, _Mastering Regular
Expressions_.  I'm sure there are many on-line tutorials, too.  This
is not the channel for questions that arise because you don't
understand how to construct a regular expression.  For now, try

subject:[ \t]*\[SPAM
subject:[ \t]*\\[SPAM

I forget offhand whether Mailman treats the strings it reads as raw
strings or as regular strings.  If the former, the first regexp is
the one that should work.  If the latter, the second will work.

-- 
School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp
University of TsukubaTennodai 1-1-1 Tsukuba 305-8573 JAPAN
   Ask not how you can do free software business;
  ask what your business can do for free software.
--
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=showamp;file=faq01.027.htp


Re: [Mailman-Users] Regexp help - Matching Subjects to Hold Posts in Mailman 2.0.11

2005-05-30 Thread David Powell
Thanks for the help, to respond...

 Life will be much easier for this kind of task if you upgrade to
 Mailman 2.1.x; 2.1.6 is current.

Agreed - I don't administer the server, but understand we're waiting for 
the new stable release of Debian (any day now).

 Really, you should invest in Jeffrey Friedl's book, _Mastering Regular
 Expressions_.  I'm sure there are many on-line tutorials, too.  This
 is not the channel for questions that arise because you don't
 understand how to construct a regular expression.  For now, try
 
 subject:[ \t]*\[SPAM
 subject:[ \t]*\\[SPAM

Neither of these worked.  I'll take a look at that book though, ta. 
Also I understand that this isn't a regexp help list, and sorry if I've 
wasted some bandwidth.

However, in my defence, prior to posting I did look at quite a few 
online tutorials, and then tested out a few expressions on some text 
files.  When I found a few expressions that worked I used these in 
mailman(without luck obviously).

Following Stephen's suggestions, I've tried a few more.  What I did was 
place the following lines (among others) in a text file.  As I'm not 
sure exactly how the subject header is formatted, I wanted something 
that would find all off the following:

subject:[SPAM 07.49] Stop your computer from crashing
subject: [SPAM 07.49] Stop your computer from crashing
subject:[SPAM 07.49] Stop your computer from crashing
Subject:[SPAM 07.49] Stop your computer from crashing
Subject: [SPAM 07.49] Stop your computer from crashing
Subject:[SPAM 07.49] Stop your computer from crashing

One line has a tab b/w : and [SPAM, another a space and the third 
nothing.  The other thing I wasn't sure about was if the first letter of 
subject is uppper case or not.

The expression I found that matched all 6 lines (using grep) was:
[sS]ubject:.*\[SPAM

I also used the find function in KATE, and found that it preferred: 
[sS]ubject:[\s]*\[SPAM

(using [\t] didn't match the lines with a tab)

Neither of these worked in mailman, so I tried with just upper, then 
lowercase 's' to start with (i.e. subject:.*\[SPAM and Subject:/* etc ).

This hasn't worked either.  So I guess I'm at a loss.  I've got my head 
around regular expressions enough to find what I want in a text file, 
but can't get it work in Mailman.

Am I dumber than I think (very possible ;-) or is there something about 
the way that Mailman handles regexps that I've missed?

Ta,

David


--
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=showamp;file=faq01.027.htp