[rt-users] Editing Email.pm to not ParseTicketId if Requestor is equal to 'X'

Luong Bui Duc luong.d.bui at gmail.com
Thu Apr 5 03:25:05 EDT 2012


Dear RT,

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 'x at y.com' but unfortunately after editing it, mailgate start throwing me
errors. Here is my code(in Bold is what i added to original RT code):

*sub ParseTicketId {*
*    my $Subject = shift;*
*    my $head = shift;*
*    my ( $Sender, $junk ) = ParseSenderAddressFromHead($head);*
*    my $rtname = RT->Config->Get('rtname');*
*    my $test_name = RT->Config->Get('EmailSubjectTagRegex') ||
qr/\Q$rtname\E/i;*
*
*
*    my $id;*
*if ( $Sender =~ m/x\@y\.com/ ) {*
*
*
*return undef;*
*} else {*
*    if ( $Subject =~ s/\[$test_name\s+\#(\d+)\s*\]//i ) {*
*        $id = $1;*
*    } else {*
*        foreach my $tag ( RT->System->SubjectTag ) {*
*            next unless $Subject =~ s/\[\Q$tag\E\s+\#(\d+)\s*\]//i;*
*            $id = $1;*
*            last;*
*        }*
*    }*
*    return undef unless $id;*
*
*
*    $RT::Logger->debug("Found a ticket ID. It's $id");*
*    return $id;*
*}*
*}*

And logs show following:

*RT server error.*
*
*
*The RT server which handled your email did not behave as expected. It*
*said:*
*
*
*Can't call method "get" on an undefined value at
/opt/rt4/sbin/../lib/RT/Interface/Email.pm line 1075.*
*
*
*Stack:*
*  [/opt/rt4/sbin/../lib/RT/Interface/Email.pm:1075]*
*  [/opt/rt4/sbin/../lib/RT/Interface/Email.pm:1210]*
*  [/opt/rt4/sbin/../lib/RT/Interface/Email.pm:1439]*
*  [/opt/rt4/share/html/REST/1.0/NoAuth/mail-gateway:61]*
*
*
*fetchmail: MDA returned nonzero status 75*


I'm pretty new to RT and Perl itself, so i hope you can point me to the
right directions.

-- 
Thanks a lot,

L
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120405/30a7a745/attachment.htm>


More information about the rt-users mailing list