[rt-users] parse_headers problem in RT 1.0.x

bill at daze.net bill at daze.net
Wed Nov 14 13:55:54 EST 2001


Hello,

With the help of an end user (lets call him user at example.com), we
discovered a problem in the mail header parsing routine in RT 1.0.7.  I
haven't had a chance to look at the RT2 code base so I'm not sure if it
has the same problem or not.

The problem:

Replies from RT were being sent to "user at example.com"@ourhostname

Why it happened:

The incoming mail from the end user had a from address in the format of:
"user at example.com" <user at example.com>

The parse_headers routine in rt-1.0.7/lib/rt/ui/mail/manipulate.pm breaks
the from address (or reply-to or sender) into the user's name and e-mail
address.  RT finds "user at example.com" as the user's e-mail address and
stores this in $current_user.  This gets saved as the requestors address,
qoutes and all.

When RT sends the mail, it sends it to "user at example.com".  Sendmail is
reading this as just the local part of an address and appends ourhostname
to it before sending the mail.

Our solution:

I added logic to rt-1.0.7/lib/rt/ui/mail/manipulate.pm to strip the quotes
from the $current_user:

    $current_user = $replyto || $from || $sender;
    
    
    #Get the real name of the current user from the replyto/from/sender/etc
    
    $name_temp  = $current_user;

    if ($current_user =~/(\S*\@\S*)/) {
	$current_user =$1;
    }
    if ($current_user =~/<(\S*\@\S*)>/){
	$current_user =$1;
    }
    if ($current_user =~/<(\S*)>/){
	$current_user =$1;
    }
    
    $current_user =~ s/\"//g; ### added to strip quotes from address

    $rt::users{"$current_user"}{'real_name'} = $name_temp;
    $rt::users{"$current_user"}{'real_name'} =~ s/(\S*)\@(\S*)//;
    $rt::users{"$current_user"}{'real_name'} =~ s/<(.*?)>//;

Regards,
Bill Gerrard






More information about the rt-users mailing list