Ticket content and different mail systems


I use such piece of script to get the content of a letter, that scomes to RT
queue. Then I place the certain part of content into appropriate custom fields
of RTFM. It works fine when a letter comes to the queue from yahoo mail. But
it doesn’t work when a letter comes from other mail systems. (the type
displayed in the received letter in the queue is shown “text/plain”).
Could you perhaps give any advice how to fix this problem?

my $attachs = $self->TransactionObj->Attachments;
my $attach;
while( my $a = $attachs->Next )
if( $a->ContentType eq ‘text/plain’ )
$attach = $a;
my $content = $attach->Content;

Hoping for the help,