Index: mailer.py =================================================================== --- mailer.py (revision 38049) +++ mailer.py (working copy) @@ -215,6 +215,15 @@ except UnicodeError: from email.Header import Header subject = Header(subject, 'utf-8').encode() + try: + searchfile = open(self.cfg.get('author2email_file', group, params)) + pattern = '^' + self.from_addr + ': .*$' + match = re.search(pattern, searchfile.read(), re.MULTILINE) + if None != match: + self.from_addr = re.sub('^' + self.from_addr + ': ', '', match.group(0)) + searchfile.close() + except IOError: + pass hdrs = 'From: %s\n' \ 'To: %s\n' \ 'Subject: %s\n' \ @@ -1360,6 +1369,4 @@ # - per-repository configuration # o extra config living in repos # o optional, non-mail log file -# o look up authors (username -> email; for the From: header) in a -# file(s) or DBM # * get rid of global functions that should properly be class methods Index: mailer.conf.example =================================================================== --- mailer.conf.example (revision 38049) +++ mailer.conf.example (working copy) @@ -164,8 +164,20 @@ # 'no_author' is used. You can specify a default from_addr here and # if you want to have a particular for_repos group use the author as # the from address, you can use "from_addr =". -from_addr = invalid@example.com +# from_addr = invalid@example.com +# this file contains a list of usernames converted into a full +# email address. It can be set pr. group as well. The contents +# of the file is in this format with one ^username: email\n pr line. +# ^jdoe: john.doe@example.com\n +# ^janed: jane.doe@example.com\n +# it also works if the file contains email addresses like this: +# jdoe: "John Doe" +# it doesnt matter if there are multiple similar lines, only the +# first is used. Basically the mailer.py script greps for the username. +author2email_file = /etc/email-addresses + + # The default To: addresses for message. One or more addresses, # separated by whitespace (no commas). # NOTE: If you want to use a different character for separating the