[Mailman-Developers] [ 805630 ] Mail to foo-bar list languishes in maildir

Richard Barrett r.barrett at openinfo.co.uk
Sat Sep 13 14:56:00 EDT 2003


On Saturday, September 13, 2003, at 04:24  pm, John A. Martin wrote:

> Mail to a list with a hyphen in its name languishes forever in
> qfiles/maildir. The culprit might be in MaildirRunner.py
>
> ,----[ MaildirRunner.py lines 65-74 ]
> # We only care about the listname and the subq as in listname@ or
> # listname-request@
> lre = re.compile(r"""
>  ^                        # start of string
>  (?P<listname>[^-@]+)     # listname@ or listname-subq@
>  (?:                      # non-grouping
>    -                      # dash separator
>    (?P<subq>[^-+@]+)      # everything up to + or - or @
>  )?                       # if it exists
>  """, re.VERBOSE | re.IGNORECASE)
> `----
>
> How about list-name@?
>
>         jam
>
You seem to have spotted an error in this experimental code.

If it is of any use, I use essentially the following code in my Mailman 
mailer for Sendmail, which eliminates the need for maintaining an 
aliases file/db, and has to solve the same problem.

# Possible VERP regexes and associated extraction variables
# which may be defined in from mm_cfg.py
# Add to this tuple if more VERP patterns are defined.
POSSIBLE_VERP_REGEX_LIST = (('VERP_REGEXP', 'bounces'),
                             ('VERP_CONFIRM_REGEXP', 'addr'))

_VALID_SUFFIX_MAP = {'admin': 'admin',
                      'bounces': 'bounces',
                      'confirm': 'confirm',
                      'join': 'join',
                      'leave': 'leave',
                      'owner': 'owner',
                      'request': 'request',
                      'subscribe': 'subscribe',
                      'unsubscribe': 'unsubscribe',
                     }

_suffix_pat = re.compile(r'(?P<listname>.+)-(?P<suffix>[^-]+)$')

def split_addr(address):
     # We are here trying to split the target alias as passed in
     # by the MTA because it was not simply a listname. We could
     # have  a VERP'ed return address and/or a listname-<function> alias.
     # Because there are multiple VERP formats and associated regexes
     # and these can be redefined in mm_cfg.py we cannot hardwire a
     # regex here to extract from VERP'ed return addresses.
     command = None
     listname, server = address.split('@', 1)
     for regex_pat_name, regex_var in POSSIBLE_VERP_REGEX_LIST:
         if hasattr(mm_cfg, regex_pat_name):
             regex_obj = re.compile(getattr(mm_cfg, regex_pat_name))
             match_obj = regex_obj.search(address)
             if match_obj:
                 listname =  match_obj.group(regex_var)
                 break
     suffix_match = _suffix_pat.match(listname)
     if suffix_match and \
        _VALID_SUFFIX_MAP.has_key(suffix_match.group('suffix')) and \
        Utils.list_exists(suffix_match.group('listname')):
         listname = suffix_match.group('listname')
         command = _VALID_SUFFIX_MAP[suffix_match.group('suffix')]
     return (listname, command)
-----------------------------------------------------------------------
Richard Barrett                               http://www.openinfo.co.uk




More information about the Mailman-Developers mailing list