=== modified file 'trac/notification.py'
|
|
|
|
| 163 | 163 | from_email = 'trac+tickets@localhost' |
| 164 | 164 | subject = '' |
| 165 | 165 | template_name = None |
| 166 | | nodomaddr_re = re.compile(r'[\w\d_\.\-]+') |
| | 166 | nodomaddr_re = re.compile(r'[\w\d_\.\-]+$') |
| 167 | 167 | addrsep_re = re.compile(r'[;\s,]+') |
| 168 | 168 | |
| 169 | 169 | def __init__(self, env): |
| … |
… |
|
| 286 | 286 | else: |
| 287 | 287 | self.env.log.info("Email address w/o domain: %s" % address) |
| 288 | 288 | return None |
| | 289 | else: |
| | 290 | self.env.log.info("Ignored email address: %s" % address) |
| | 291 | return None |
| 289 | 292 | |
| 290 | 293 | mo = self.shortaddr_re.search(address) |
| 291 | 294 | if mo: |
=== modified file 'trac/ticket/tests/notification.py'
|
|
|
|
| 268 | 268 | self.env.config.set('notification', 'always_notify_reporter', |
| 269 | 269 | 'false') |
| 270 | 270 | self.env.config.set('notification', 'smtp_always_cc', '') |
| | 271 | self.env.config.set('notification', 'ignore_domains', |
| | 272 | 'ignored.example.com') |
| 271 | 273 | ticket = Ticket(self.env) |
| 272 | | ticket['cc'] = 'joenodom, joewithdom@example.com' |
| | 274 | ticket['cc'] = 'joenodom, joewithdom@example.com, ' \ |
| | 275 | 'otherjoe@ignored.example.com' |
| 273 | 276 | ticket['summary'] = 'This is a summary' |
| 274 | 277 | ticket.insert() |
| 275 | 278 | # Be sure that at least one email address is valid, so that we |
| … |
… |
|
| 288 | 291 | cclist = [addr.strip() for addr in headers['Cc'].split(',')] |
| 289 | 292 | self.failIf('joewithdom@example.com' not in cclist) |
| 290 | 293 | self.failIf('joe.bar@example.net' not in cclist) |
| | 294 | self.failIf(headers['Cc'].find('ignored') >= 0) |
| 291 | 295 | if not enabled: |
| 292 | 296 | self.failIf(len(cclist) != 2) |
| 293 | 297 | self.failIf('joenodom' in cclist) |
| … |
… |
|
| 347 | 351 | # 'To' list should have been resolved to the actual email address |
| 348 | 352 | self.failIf('kerb@example.net' not in tolist) |
| 349 | 353 | self.failIf(len(tolist) != 1) |
| 350 | | |
| | 354 | |
| 351 | 355 | def test_admit_domains(self): |
| 352 | 356 | """SMTP domain inclusion""" |
| 353 | 357 | self.env.config.set('notification', 'admit_domains', |