I'm working on a scrip to store past correspondence on a ticket in a
customer's e-mail archive when a customer id (custom field value) is
added to a ticket.  I've got everything working, except that I'd
really like to send the original, unparsed e-mail, not what I'm
extracting from the message objects.  Is there an accessor for that?

Here's the relevant section of my template:

{ my $transactions = $Ticket->Transactions;
 $transactions->Limit( FIELD => 'Type', VALUE => 'Correspond' );
 $transactions->Limit( FIELD => 'Type', VALUE => 'Comment' );
 $transactions->Limit( FIELD => 'Type', VALUE => 'Create' );
 while (my $transaction = $transactions->Next) {
   my $attachments = $transaction->Attachments;

   while (my $message = $attachments->Next) {
     next unless $message->ContentType =~
              m!^(text/html|text/plain|message|text$)!i; 

     my $content = $message->Content;
     next unless $content;

     next if $last_content eq $content;
     $last_content = $content;

# now I create subject, from & time headers
# would prefer original e-mail!

     my $subject = ($message->Subject || $Ticket->Subject);

     my $wrapper = Text::Wrapper->new(columns=>70);
     $content = $wrapper->wrap($content);

     $archived_message .= "Subject: ";
     $archived_message .= $subject;
     $archived_message .= "\n";
     $archived_message .= "From: ";
     $archived_message .= $message->CreatorObj->RealName || 
$message->CreatorObj->EmailAddress;
     $archived_message .= "\n";
     $archived_message .= "Time: ";
     $archived_message .= $message->CreatedObj->AsString;
     $archived_message .= "\n";
     $archived_message .= "\n";
     $archived_message .= "$content\n";
     $archived_message .= "------------------------------------------------\n";
   }
 }
 $archived_message;
}


-- 
Eleanor J. (Piglet) Evans, e...@panix.com
Customer Support, (212) 741-4400
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Reply via email to