[rt-users] Adding Domain Name to Outgoing Email Addresses

Larry Stone lcs at MIT.EDU
Tue Feb 3 00:56:20 EST 2004


> On Mon, Feb 02, 2004 at 04:41:53PM -0500, Stephen Turner wrote:
> > We'd like to be able to specify email addresses on tickets without
> > having to type the domain name (i.e.. just type "joeuser" rather than
> > "joeuser at ourfirm.com" ).
>
> I think what you want RT to be doing is canonicalizing the email address
> on input, not on output.   Grep the config file for "CanonicalizeEmail".
> It may well be that the standard regex won't meet your needs and you'll
> need to overlay the entire subroutine, but that should take care of what
> you need.

You were right, it can't be done with just the regular expression variables,
although the CanonicalizeEmailAddress method of User does munge
addresses coming in from the UI -- I'd assumed it was strictly for
the email interface.

The RT::CanonicalizeEmail* variables don't work because, to append "@domain"
to the address, you need to match an address with no "@" in it and then
interpolate it in the replacement string -- if the replacement string
is itself in a variable, any "$1" reference buried in it does not get
interpolated.

Altering the code in a User_Local.pm file works, just added the line:

    $email =~ s/^([^@]+)$/${1}\@mit.edu/i;

As a more general solution, I think it would be more intuitive if
the /Ticket/ModifyPeople.html accepted *either* RT userids (without the "@")
or email addresses (with the @).  Right now, it _displays_ the RT userid
for existing watchers, which won't have the "@" for e.g. local privileged
users, yet adding a user the way it is shown, fails.

If you would suggest where in the code to put the logic I could work on
a patch.

thanks,

    -- Larry




More information about the rt-users mailing list