S/MIME signed mail with attachments

I think there is an issue with signing a MailMessage object, that contains an attachment. When we create and send a signed MailMessage with an attachment (other than the smime.p7s attachment), then the mail is not displayed correctly in mail clients (tested with Thunderbird, Outlook and Apple Mail). No content or attachments are shown for the mail.
I investigated the resulting source of the MailMessage and think that there is a problem with the boundary of the MIME message. Aspose seems to not handle that correctly.

The process in our application is like this:

  • user composes an email and adds attachment
  • before sending, the MailMessage is signed (call to attachSignature Method of MailMessage)
  • send mail (e,g, using ImapClient)

I’ll attach two sample eml files, that hopefully clarify what I mean
Archiv.zip (18.7 KB)

File “ASPOSE_SIGNED_WITH_ATTACHMENT.eml” is the output from our application, that has the issue (I modified mail addresses)
File “ASPOSE_SIGNED_WITH_ATTACHMENT_MODIFIED_MANUALLY.eml” contains changes I made manually to the boundary - if I open that file in e.g. Thunderbird, I can see the content.
By the way, I tried with Aspose versions 22.12, 23.3 and 23.10 - same behavior…

Can you please investigate?

We have opened the following new ticket in our internal issue tracking system and will deliver their fixes as soon as possible.

Issue ID(s): EMAILJAVA-35220