Email client integration

I have been using 3.6 for about a year fairly successfully, and I
have more recently setup the CommandByMail extension to help in
closing tickets as part of my email work process. I use mutt for
email, and I wrote a perl script that takes an email on stdin and
sends an email with the same subject as to the comment address of
the queue, with Status: resolved. Then, I have
macro pager S "~/bin/rtresolve.pl"
in my muttrc so I just press a key while viewing the message to
close the ticket. However, I still don’t have a good way of
seeing the status of tickets in mutt or another mail program. Has
anyone done anything like this, or have suggestions for my ticket
closing script?

#!/usr/bin/perl

use warnings;
use strict;

use Mail::Sendmail;

my ($replyto, $replyfrom, $subject, $queue, $rthost, $isaticket);

#it must be from the address RT thinks you have
$replyfrom="nick@prgmr.com";

while () {
chomp $_;
if (/^Reply-To: (.@.)$/) {$replyto=$1;}
if (/^RT-Ticket:/) {$isaticket=“true”;}
if (/^Subject: (.*)$/) {$subject=$1;}
}

if($isaticket) {
if ($replyto=~/^(.)(-comment){0}@(.)$/) {
$queue=$1;
$rthost=$3;
}
}
else {
print “Not a ticket.\n”;
exit(1);
}

my %mail=(
server => ‘localhost’,
from => $replyfrom,
to => “$queue-comment@$rthost”,
subject => $subject,
body => ‘Status: resolved’,
);

sendmail(%mail) or die $Mail::Sendmail::error;
exit(0);

Thanks,
Nick Schmalenberger