<html>
<body>
Nelson,<br><br>
Here's how I include the resolver's message with our standard
"resolved" blurb. This is my (slightly modified) template
for OnResolve. The guts of what you want to do is that I grab the
last correspondence, compare it to the last outgoing e-mail (don't
include it if they're the same), then see if it's incoming e-mail (don't
include it if so). If it passes those tests, then I include it in
my standard blurb to the requestor. There are probably cleaner ways
to do this, but I'm using this in production and it works.<br><br>
Regards,<br>
Gene<br><br>
===== start of template contents<br>
{ ### Tells user that ticket has been resolved<br>
my $MyName = "Template 28 (Resolved)";<br>
#$RT::Logger->debug("$MyName (". $Transaction->Id .
") entered.");<br>
my $FromAddress = 'RT Requests <rt@myorg.org>';<br>
my $ContactAddress = 'real.person@myorg.org';<br>
my $OwnerName = $Ticket->OwnerObj->RealName;<br>
my $c_content;<br>
my $e_content;<br>
my $have_rmks;<br>
my $remarks;<br><br>
### We won't include a comment if...<br>
### - Last outgoing email content eq last correspond content (this
means<br>
### that the content was already sent in an
e-mail)<br>
### - Last correspond attachment headers =~ /^Received/ (this
means that <br>
### the correspond was an incoming e-mail)<br><br>
### Get last Correspond<br>
my $Transactions = $Ticket->Transactions;<br>
$Transactions->Limit( FIELD => 'Type', VALUE =>
'Correspond' );<br>
$Transactions->OrderByCols (<br>
{ FIELD => 'Created', ORDER =>
'DESC' },<br>
{ FIELD => 'id',
ORDER => 'DESC' },<br>
);<br>
my $CorrespondObj = $Transactions->First;<br>
if ($CorrespondObj && $CorrespondObj->Id) {<br>
$c_content = $CorrespondObj->Content;<br>
chomp $c_content;<br>
$have_rmks =
!$CorrespondObj->Attachments->First->GetHeader('Received');<br>
#$RT::Logger->debug("$MyName: found correspondence:
'$_content'") if $have_rmks;<br>
}<br><br>
### Get last outgoing e-mail<br>
$Transactions = $Ticket->Transactions;<br>
$Transactions->Limit( FIELD => 'Type', VALUE =>
'EmailRecord' );<br>
$Transactions->OrderByCols (<br>
{ FIELD => 'Created', ORDER =>
'DESC' },<br>
{ FIELD => 'id',
ORDER => 'DESC' },<br>
);<br>
my $EmailObj = $Transactions->First;<br>
if ($EmailObj && $EmailObj->Id) {<br>
$e_content = $EmailObj->Content;<br>
chomp $e_content;<br>
if ($c_content) {<br>
$have_rmks = 0 if $e_content eq
$c_content;<br>
$have_rmks = 0 if $EmailObj->Id >
$CorrespondObj->Id;<br>
}<br>
}<br><br>
use Mail::Address;<br>
my $Cc = '';<br>
my $Bcc = '';<br>
if ( $have_rmks ) {<br>
my $attachment =
$CorrespondObj->Attachments->First;<br>
my @cc_addrs =
Mail::Address->parse($attachment->GetHeader('RT-Send-Cc'));<br>
my @bcc_addrs =
Mail::Address->parse($attachment->GetHeader('RT-Send-Bcc'));<br>
foreach my $addr ( @cc_addrs ) {<br>
$Cc .= $addr->address . ",
";<br>
}<br>
$Cc .=
$Ticket->QueueObj->Cc->MemberEmailAddressesAsString;<br>
$Cc =~ s/, $//;<br>
<br>
foreach my $addr ( @bcc_addrs ) {<br>
$Bcc .= $addr->address . ",
";<br>
}<br>
$Bcc .=
$Ticket->QueueObj->AdminCc->MemberEmailAddressesAsString;<br>
$Bcc =~ s/, $//;<br>
}<br><br>
### Set the remarks if applicable<br>
if ($have_rmks) {<br>
$remarks = "<br>
Comments:<br>
====================<br>
$c_content<br>
====================";<br>
#$RT::Logger->debug("$MyName: going to send comments:
$remarks");<br>
}<br>
my $AddressGroup = "From: $FromAddress";<br>
$AddressGroup .= "\nCc: $Cc" if $Cc;<br>
$AddressGroup .= "\nBcc: $Bcc" if $Bcc;<br>
$OUT = "$AddressGroup<br>
Subject: Action completed for your request<br><br>
The ticket that was opened for your request has been resolved by
$OwnerName. If you have any questions about this, you can contact
us at $ContactAddress.<br>
$remarks<br><br>
Regards,<br>
The IT Staff";<br><br>
}<br>
===== end of template contents<br><br>
At 10:42 AM 5/5/2008, Nelson Pereira wrote:<br>
<blockquote type=cite class=cite cite="">Content-Class:
urn:content-classes:message<br>
Content-Type: multipart/related;
type="multipart/alternative";<br>
<x-tab> </x-tab>
boundary="----_=_NextPart_001_01C8AED7.61321FB3"<br><br>
<font face="arial" size=2>Hi,<br>
<br>
Wondering how to do this:<br>
<br>
When I resolve a ticket, I want RT to send the message I put in the
resolve to the requestor, and not the default “as per our records….”<br>
<br>
</font><font face="Times New Roman, Times"> <br>
</font><font face="verdana" size=2 color="#000033"><b>Nelson
Pereira</b></font> <font face="verdana" size=1 color="#000033"><br>
Senior Network Administrator <br>
</font></blockquote>
<x-sigsep><p></x-sigsep>
<br>
-- <br>
Gene LeDuc, GSEC<br>
Security Analyst<br>
San Diego State University</body>
</html>