[rt-users] [script] Closing tickets via mail (e.g. Cc: done at rt.site.com)
Christian Hammers
ch at westend.com
Thu Oct 28 10:36:00 EDT 2004
On Mon, Oct 25, 2004 at 02:54:59PM +0200, Christian Hammers wrote:
> I'm looking for a way to close a ticket via email. What would be the
> best approach? My only idea is currently to create a special alias
> which then executes rt-crontool.
In case anybody has a use for it, here is a little script that accepts
mails for "done at support.mydomain.com", extracts the ticket number and
closes this ticket with a comment.
bye,
-christian-
#!/usr/bin/perl -W
# Quick and dirty script, no real return code checking.
use Sys::Syslog;
openlog("rt-mail-done", 0, LOG_DAEMON);
$mail = join("", <STDIN>);
if ($mail =~ /^Subject.*\[Ticket #([0-9]+)\]/m) {
$ticketstring = "ticket/$1";
} else {
die("No ticket number found!");
}
$cmd = "rt comment -m 'Ticket has been closed via email.' $ticketstring";
$out = "$cmd: ".`$cmd 2>&1`; chomp($out); syslog(LOG_INFO, $out);
$cmd = "rt edit $ticketstring set status=resolved";
$out = "$cmd: ".`$cmd 2>&1`; chomp($out); syslog(LOG_INFO, $out);
exit(0);
--
Christian Hammers WESTEND GmbH | Internet-Business-Provider
Technik CISCO Systems Partner - Authorized Reseller
Lütticher Straße 10 Tel 0241/701333-11
ch at westend.com D-52064 Aachen Fax 0241/911879
More information about the rt-users
mailing list