Here is a version a bit improved :

Last correspondence of the ticket:
==================================

{
my $txns = $Ticket->Transactions;
$txns->Limit(
FIELD    => 'Type',
VALUE    => $_,
) for qw(Create Correspond Comment);

my $last_content;
my $AttachmentObjects = $txns->Last()->Attachments;
while( my $at = $AttachmentObjects->Next()){
        next if $at->ContentType !~ m!^(text/html|text/plain|message|text$)!i;
        $last_content = $at->Content;
}

$html = HTML::TreeBuilder->new();
$html->parse($last_content);
$formatter = HTML::FormatText->new(leftmargin => 0, rightmargin => 50);
$formatter->format($html);

}

-- 
L.B.

--------
2011 Training: http://bestpractical.com/services/training.html

Reply via email to