Add default e-mail domain mapping
|Reported by:||Owned by:||eblot|
|Severity:||normal||Keywords:||notification email patch|
|Cc:||mrw7mrw@… hshin@… nielsen@…|
I am using Trac for an internal project, so every user has the same e-mail domain. I am also using LDAP, so I prefer to have people login with a username and not an e-mail address. At the same time, I would like people to be able to receive e-mail notifications when tickets are updated.
To accomplish this, I put together a small patch that adds a new configuration variable:
The patch is small and simply adds another elif statement within Notify.py:
around line 98: self.replyto_email = self.config.get('notification', 'smtp_replyto') self.from_email = self.from_email or self.replyto_email self.default_domain = self.config.get('notification', 'smtp_defaultdomai n') around line 309: for recipient in recipients: if recipient.find('@') >= 0: emails.append(recipient) elif self.email_map.has_key(recipient): emails.append(self.email_map[recipient]) elif self.default_domain != '': emails.append(recipient+'@'+self.default_domain)
The idea is that if the system currently can't resolve a username to an e-mail address, it simply appends the default domain to create the e-mail address. Although this isn't suitable for projects with users from different internet domains, it is very useful for projects like mine where every user has the same e-mail domain (i.e. they are all my employees).
Change History (12)
comment:8 Changed 8 years ago by
- Milestone set to 0.10
- Owner changed from jonas to eblot
- Status changed from new to assigned