Modifying email attachments leads to "Message may be corrupt" displayed in POP3/IMAP clients

I have written an Extension manager dll using C-API 8.0.1 where I process incoming SMTP-based mail and blocks certain attachments. When an attachment is removed I add a text file explaining. I use NSFNote… functions to do add and remove of files. The user receives the corrected email as long as he uses Notes, but if he uses POP3/IMAP client like Thunderbird, all that is displayed is a blank email or a message saying “Message may be corrupt! Note item not found.”.Playing around with the option for incoming message format I found that “Prefers Notes Rich Text” delivers the email correct to the User, but “Prefers MIME” and “Keep in Senders format” both give errors.

Anyone have an idea how to solve this in code without changing the incoming message format ?

Subject: what does the incoming message look like?

is it s/mime signed?