[rt-users] unparsed e-mail available?
Eleanor J. Evans [Panix Staff]
eje at panix.com
Thu Dec 10 12:49:56 EST 2009
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, eje at panix.com
Customer Support, (212) 741-4400
More information about the rt-users
mailing list