+1 vote
by (130 points)
retagged by

I am considering to buy Rebex Secure Mail.
So I am using trial version.

I want to send e-mail using iso-2022-jp encoding.
However, it is not going well.

MimeMessage message = new MimeMessage();
message.DefaultCharset = Encoding.GetEncoding("ISO-2022-JP");
message.To = new MailAddressCollection("sende@sender.net");
message.From = new MailAddressCollection("送信者<sender@sender.net>");
message.Subject = "これはテストメールです";
message.SetContent("これはテストメールです");
message.TransferEncoding = TransferEncoding.Base64;
message.ContentTransferEncoding = new ContentTransferEncoding(TransferEncoding.SevenBit);
message.Options = MimeOptions.AlwaysWriteContentTransferEncoding;

*e-mail address is fake

this result
subject is encoded as Quoted-printable. (Subject: =?iso-2022-jp?Q?=....)
but my expecting result is to be encoded as base64. (Subject: =?iso-2022-jp?B?=....)

please help me.

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (58.9k points)
edited by

Hello from Prague to Japan and thank you for trying Rebex Secure Mail for your japanese c# email needs!

The transfer encoding of the other headers (including Subject) is automatically determined by the Rebex Secure Mail component.

Actually, the component chose QuotedPrintable encoding because the result was shorter ("=1B$B$3$l$O%F%9%H%a!=3C%k$G$9=1B=28B") than the Base64 encoded form ("GyRCJDMkbCRPJUYlOSVIJWEhPCVrJEckORsoQg==").

Do you think that it would be more suitable for Japanese emails to use base64 encoding for the headers and why?
If yes, please let us know and we could change the behavior of Rebex Secure Mail to automatically handle this.

P.S. actually, neither the MimeMessage.ContentTransferEncoding nor MimeMessage.TransferEncoding sets the transfer encoding of the headers like Subject, From, etc. In fact these properties only affect the email body. And it is useless to set both of them becuase both translate into the same "Content-Transfer-Encoding" header in the resulting MIME message.

...