0 votes
by (200 points)
edited

Hi - I received this error when trying to send the signed html single part email:

  Rebex.Mime.MimeException: Cannot change read-only message.
   at Rebex.Mime.MimeEntity.set_TransferEncoding(TransferEncoding value)
   at Rebex.Net.Smtp.BUPqsk(MimeEntity , TransferEncoding , TransferEncoding )
   at Rebex.Net.Smtp.BUPqsk(MimeEntity , TransferEncoding , TransferEncoding )
   at Rebex.Net.Smtp.BTPxIKZ(MimeMessage , Stream , MailAddress , MailAddressCollection )
   at Rebex.Net.Smtp.Send(MimeMessage mail, String sender, String recipients)
   at Rebex.Net.Smtp.Send(MimeMessage mail)
   at Rebex.Net.Smtp.Send(MimeMessage message, String serverName, Int32 serverPort)
   at Rebex.Net.Smtp.Send(MailMessage message, String serverName, Int32 serverPort)

I only have this issue with the signed email, not the unsigned. Any help would be appreciated. Thanks!

Applies to: Rebex Secure Mail
by (148k points)
edited

Are you using Rebex Secure Mail v1.0.4086.0 or earlier? In Rebex Secure Mail 2012 R1 and later, an exception of "A message part uses a content-transfer-encoding which is not accepted by the server and cannot be changed" should be thrown instead in this case.

1 Answer

+1 vote
by (148k points)
edited

Once a message is signed, Rebex Secure Mail treats most parts of it 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" extension, but one of the message parts uses "8bit" 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 would invalidate the signature) and the only possible behavior is to report an error. This used to be "Cannot change read-only message" in old versions of Rebex Secure Mail (until v1.0.4086.0), but we changed it to more meaningful "A message part uses a content-transfer-encoding which is not accepted by the server and cannot be changed" (since Rebex Secure Mail 2012 R1).

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).

by (200 points)
edited

Thanks Lukas! The answer makes sense. I will try your solution and will let you know. Yes, we are using the Rebex for .NET 2.0 version.

...