[rt-users] Stripping off subdomains in $email

Darrin Walton darrinw at nixc.net
Wed Sep 26 21:49:58 EDT 2001


  |+ 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





More information about the rt-users mailing list