- my $msg = $tkt_txns->{$txn};
-
- # $msg contains an RT::Attachment with our outgoing
- # message. Print a few headers for clarity's sake.
- $contents_body .= "From: " . $msg->GetHeader('From') . "\n";
- my $date = $msg->GetHeader('Date ');
+ my $top = $tkt_txns->{$txn}->Attachments->First;
+
+ # $top contains the top-most RT::Attachment with our
+ # outgoing message. It may not be the MIME part with
+ # the content. Print a few headers from it for
+ # clarity's sake.
+ $contents_body .= "From: " . $top->GetHeader('From') . "\n";
+ my $date = $top->GetHeader('Date ');