0 votes
by (140 points)


i'm trying to send a mail with a signed .eml attachment, but the send method return the following message:

"A message part uses a content-transfer-encoding which is not accepted by the server and cannot be changed"

I can send the same attachment from the webmail


Applies to: Rebex Secure Mail

1 Answer

0 votes
by (144k points)
edited by

When a message is signed, Rebex Secure Mail treats most parts of it (including attachments) as read-only because changing them would invalidate the signature.

The most likely reason for the error you got is that you are trying to send a signed message through an SMTP server that doesn't support "8-bit MIME" or "binary MIME" extensions, but one of the message parts uses "8bit" or "binary" content transfer encoding. In this case, we would normally convert the part to use "base64" or "quoted-printable" encoding before sending.

However, if the message is signed, this is not be possible (it might invalidate the signature) and the proper behavior is to report an error.

If you are signing the emails using Rebex code, a solution for this would be to make sure there are no "8bit" or "binary" MIME parts before signing the message (and change the content transfer encoding to "base64" if there are).

I'm not sure about the webmail, but if it actually skips the check and sends a signed email using "8bit" or "binary" encoding through an SMTP server that doesn't support it, you might end up with an invalid signature (unless the encoding was not actually "8bit" or "binary").

You can force sending of these messages by disabling the check:

smtp.Settings.SkipContentTransferEncodingCheck = true;

(where smtp is the instance of Smtp object)

by (140 points)
I checked and i noticed that the message sent from webmail contains a valid signature and that he smtp server support the 8bit enconding (SmtpExtensions.EightBitMime), but not the binary Mime.
How is it possible?
by (144k points)
Actually, what I wrote applies to binary MIME as well - but we encounter "binary" Content-transfer-encoding so rarely that I forgot to mention that, which was a mistake.
I updated my reply and also added a potential workaround, which should work if the message sent from the webmail seems to actually work fine.
by (140 points)
Yes! The workaround works and the email is sent with the valid signed attachment

Thanks a lot!