- return Email::MIME->create(
- attributes => \%attributes,
- body => $attachment_content,
+ my $ent;
+ if ( $attributes{Type} eq 'message/rfc822' ) {
+ my $fh = IO::File->new($attributes{Path}, "r");
+ if (! defined $fh) {
+ return undef;
+ }
+ $ent = $parser->parse($fh);
+ undef $fh;
+ my $head = $ent->head;
+ $head->replace('Content-disposition','attachment; filename='.$attributes{Filename});
+ } else {
+ $ent = MIME::Entity->build(%attributes);
+ }
+ push @{ $self->{mail_attachments}} , SL::DB::EmailJournalAttachment->new(
+ name => $attributes{Filename},
+ mime_type => $attributes{Type},
+ content => ( $email_journal > 1 ? $attachment_content : ' '),
+ file_id => $file_id,