Stripping off subdomains in $email

Phone in requestor gives me an email address of user@panky.edu and then
tries to reply to RT with a ‘From:’ of user@hanky.panky.edu. RT
correctly seys “Permission denied”.

I suppose this host has miconfigured its mail server or UMA. I’m
encountering quite a lot of these. Non the less, I have to dig these up
out of a backup email account and enter them as a comment to the ticket.

My options:

  1. change user’s email to user@hanky.panky.edu
  2. edit config.pm::CanonicalizeAddress →
    $email =~ s/@\w*.(\w*.\w*)/@$1/

Option 1) is tedious and may fail if there is no dns for hanky.panky.edu
or if user emails from multiple hosts
Option 2) fails for any valid three part email addresses in the system

Do I have any other options? My perl is juvinile but improving.

Or at least can I tweek RT to notify me when someone’s email is not
accepted?

ashley

|+ Do I have any other options? My perl is juvinile but improving.

Can’t you just use RT’s CanonicalizeAddress feature?

CanonicalizeAddress converts email addresses into canonical form.

it takes one email address in and returns the proper canonical

form. You can dump whatever your proper local config is in here

sub CanonicalizeAddress {
my $email = shift;
# Example: the following rule would treat all email
# coming from a subdomain as coming from second level domain
# foo.com
#$email =~ s/@(.*).foo.com/@foo.com/;
return ($email)
}

-darrin

What I am imagining is an if-then in the mail gate code:

if $email does not authenticate and domain name is more than two levels
{
strip off a domain level and retry it;
}

Any pointers on where to start?

ddashley
ashlyeOn Thu, Sep 27, 2001 at 01:49:58AM +0000, Darrin Walton wrote:

|+ Do I have any other options? My perl is juvinile but improving.

Can’t you just use RT’s CanonicalizeAddress feature?

CanonicalizeAddress converts email addresses into canonical form.

it takes one email address in and returns the proper canonical

form. You can dump whatever your proper local config is in here

sub CanonicalizeAddress {
my $email = shift;
# Example: the following rule would treat all email
# coming from a subdomain as coming from second level domain
# foo.com
#$email =~ s/@(.*).foo.com/@foo.com/;
return ($email)
}

-darrin