- return Email::MIME->create(
- attributes => \%attributes,
- body => $attachment_content,
+ $::lxdebug->message(LXDebug->DEBUG2(), "mail6 mtype=" . $attributes{content_type} . " filename=" . $attributes{filename});
+
+ my $ent;
+ if ( $attributes{content_type} eq 'message/rfc822' ) {
+ $ent = Email::MIME->new($attachment_content);
+ $ent->header_str_set('Content-disposition' => 'attachment; filename='.$attributes{filename});
+ } else {
+ $ent = Email::MIME->create(
+ attributes => \%attributes,
+ body => $attachment_content,
+ );
+ }
+
+ push @{ $self->{mail_attachments}} , SL::DB::EmailJournalAttachment->new(
+ name => $attributes{filename},
+ mime_type => $attributes{content_type},
+ content => ( $email_journal > 1 ? $attachment_content : ' '),
+ file_id => $file_id,