[Trac-tickets] [The Trac Project] #2365: Add default e-mail domain
mapping
The Trac Project
noreply at edgewall.com
Wed Nov 16 13:46:55 CST 2005
#2365: Add default e-mail domain mapping
------------------------------+---------------------------------------------
Reporter: mrw7mrw at yahoo.ca | Owner: jonas
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: general | Version: 0.9
Severity: normal | Keywords: |
------------------------------+---------------------------------------------
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:
[notification]
smtp_defaultdomain=mydomain.com
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).
--
Ticket URL: <http://projects.edgewall.com/trac/ticket/2365>
The Trac Project <http://trac.edgewall.com/>
More information about the Trac-Tickets
mailing list