Edgewall Software

Opened 17 years ago

Closed 16 years ago

Last modified 16 years ago

#2365 closed enhancement (fixed)

Add default e-mail domain mapping

Reported by: mrw7mrw@… Owned by: Emmanuel Blot
Priority: normal Milestone: 0.10
Component: general Version: 0.9
Severity: normal Keywords: notification email patch
Cc: mrw7mrw@… hshin@… nielsen@… Branch:
Release Notes:
API Changes:
Internal Changes:


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

around line 309:

for recipient in recipients:
            if recipient.find('@') >= 0:
            elif self.email_map.has_key(recipient):
            elif 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).

Attachments (3)

Notify.py (12.7 KB ) - added by mrw7mrw@… 17 years ago.
Modified Notify.py
trac-default-domain-2365.patch (1.1 KB ) - added by nielsen@… 17 years ago.
The same functionality as a patch
trac-default-domain-0.9stable-2851.patch (1.2 KB ) - added by jornh 16 years ago.
improved the patch a bit - applies to the 0.9 stable branch

Download all attachments as: .zip

Change History (12)

by mrw7mrw@…, 17 years ago

Attachment: Notify.py added

Modified Notify.py

comment:1 by Emmanuel Blot, 17 years ago

Keywords: notification email added

I also use LDAP, but as I have access to the SMTP server, I've set up the SMTP server to resolve the username into the user e-mail address, using the LDAP directory.

However, I agree that a default domain may also be useful.

comment:2 by Matthew Williams <mrw7mrw@…>, 17 years ago

Cc: mrw7mrw@… added

comment:3 by Haisoo Shin, 17 years ago

Cc: hshin@… added; mrw7mrw@… removed

This feature should definitely be in the next release. Very useful for small company.

comment:4 by anonymous, 17 years ago

Cc: mrw7mrw@… added; hshin@… removed

by nielsen@…, 17 years ago

The same functionality as a patch

comment:5 by anonymous, 17 years ago

Cc: mrw7mrw@… added; mrw7mrw@… removed

comment:6 by anonymous, 16 years ago

This is a duplicate of #464. And decided that it wasnt a neccessary enhancement.

comment:7 by jornh, 16 years ago

Keywords: patch added

No this is not a duplicate of #464 which was about mapping usernames to user accounts on the host where trac is running. This is about adding an optional fallback to a default domain name that you can configure in trac.ini which is more generic.

IMHO one good argument for having this feature is in a company setting with several trac environments you would otherwise require all users to either use full email adresses in the tickets or that all users set their full email adresses under 'settings' for each separate trac environment.

See also #1286 which describes the need for adding a default domain for ticket notification mails. I think #1286 can be closed because it's essentially about the same requirement but this ticket (#2365) is better since it contains a simpler and newer patch that can be applied to trac 0.9.

by jornh, 16 years ago

improved the patch a bit - applies to the 0.9 stable branch

comment:8 by Emmanuel Blot, 16 years ago

Milestone: 0.10
Owner: changed from Jonas Borgström to Emmanuel Blot
Status: newassigned

comment:9 by Emmanuel Blot, 16 years ago

Resolution: fixed
Status: assignedclosed

Should be fixed in [2936].

[notification] option to use in trac.ini is smtp_default_domain.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Emmanuel Blot.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Emmanuel Blot to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.