<div class="gmail_quote">Dear RT, <div><br></div><div>I'm trying to edit /opt/rt4/lib/RT/Interface/Email.pm sub called ParseTicketId to not return ticket $id if Requestor email is equal to '<a href="mailto:x@y.com" target="_blank">x@y.com</a>' but unfortunately after editing it, mailgate start throwing me errors. Here is my code(in Bold is what i added to original RT code): </div>

<div><br></div><div><div><i>sub ParseTicketId {</i></div><div><i>    my $Subject = shift;</i></div><div><b><i>    my $head = shift;</i></b></div><div><b><i>    my ( $Sender, $junk ) = ParseSenderAddressFromHead($head);</i></b></div>

<div><i>    my $rtname = RT->Config->Get('rtname');</i></div><div><i>    my $test_name = RT->Config->Get('EmailSubjectTagRegex') || qr/\Q$rtname\E/i;</i></div><div><i><br></i></div><div><i>    my $id;</i></div>

<div><b><i>if ( $Sender =~ m/x\@y\.com/ ) {</i></b></div><div><b><i><br></i></b></div><div><b><i>return undef;</i></b></div><div><b><i>} else {</i></b></div><div><i>    if ( $Subject =~ s/\[$test_name\s+\#(\d+)\s*\]//i ) {</i></div>

<div><i>        $id = $1;</i></div><div><i>    } else {</i></div><div><i>        foreach my $tag ( RT->System->SubjectTag ) {</i></div><div><i>            next unless $Subject =~ s/\[\Q$tag\E\s+\#(\d+)\s*\]//i;</i></div>

<div><i>            $id = $1;</i></div><div><i>            last;</i></div><div><i>        }</i></div><div><i>    }</i></div><div><i>    return undef unless $id;</i></div><div><i><br></i></div><div><i>    $RT::Logger->debug("Found a ticket ID. It's $id");</i></div>

<div><i>    return $id;</i></div><div><b><i>}</i></b></div><div><i>}</i></div></div><div><br></div><div>And logs show following: </div><div><br></div><div><div><i>RT server error.</i></div><div><i><br></i></div><div><i>The RT server which handled your email did not behave as expected. It</i></div>

<div><i>said:</i></div><div><i><br></i></div><div><i>Can't call method "get" on an undefined value at /opt/rt4/sbin/../lib/RT/Interface/Email.pm line 1075.</i></div><div><i><br></i></div><div><i>Stack:</i></div>

<div><i>  [/opt/rt4/sbin/../lib/RT/Interface/Email.pm:1075]</i></div><div><i>  [/opt/rt4/sbin/../lib/RT/Interface/Email.pm:1210]</i></div><div><i>  [/opt/rt4/sbin/../lib/RT/Interface/Email.pm:1439]</i></div><div><i>  [/opt/rt4/share/html/REST/1.0/NoAuth/mail-gateway:61]</i></div>

<div><i><br></i></div><div><i>fetchmail: MDA returned nonzero status 75</i></div></div><div><br></div><div><br></div><div>I'm pretty new to RT and Perl itself, so i hope you can point me to the right directions. </div>
<span class="HOEnZb"><font color="#888888">
<div><div><br></div>-- <br>Thanks a lot,<div><br></div><div>L</div></div></font></span></div><font color="#888888"><br></font><br>