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.net> The highway is for gamblers, San Francisco Bay Area, California better 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