Sending message wrong encoding

0 votes
asked Jun 21, 2011 by _Oz_ (360 points)
edited Jun 21, 2011

Hello. We bought your "Rebex IMAP over SSL" on last week.

Now we integrate the component into our production code and got seriuos issue: We have a problem with encoding of messages in russian language (codepage win-1251). Delivered messages has a bad encoding so recipients can not read messages. itr's very important for us to fix this asap. Please provide us with some information/workaround regarding to this problem. Looking forward for your feedback.

One more issue: could you say, wht can be the reason of "ImapException: Another operation is pending."

  • RefreshInbox, check new emails exception. Rebex.Net.ImapException: Another operation is pending. at Rebex.Net.Imap.bNVhrT() at Rebex.Net.Imap.SelectFolder(String folder, Boolean readOnly) at LiapunovAndCo.Patent.DataAccess.MailClient.RebexImapProvider.SelectFolder(String folder) at LiapunovAndCo.Patent.DataAccess.MailClient.ImapFacade.SelectFolder(String folder) at
Applies to: Rebex Secure Mail

1 Answer

+1 vote
answered Jun 21, 2011 by Lukas Matyska (60,770 points)
edited Jun 21, 2011

To solve problem with encoding we first need to diagnose when the problem arises.

It can be in three places:

  1. The massage is encoded incorrectly when created (before send)
  2. The message is encoded incorrectly when sent (in SMTP layer)
  3. The message is encoded incorrectly when received (in IMAP layer)

Can you please save the message before you send it and ensure the message is encoded correctly? It can be done as follows:

MailMessage mail = new MailMessage();
// set the mail From, To, Subject, Body etc.
// then save the mail
mail.Save("file_path.eml");

If the message is encoded incorrectly please specify the message encoding as follows:
mail.DefaultCharset = Encoding.UTF8;
or
mail.DefaultCharset = Encoding.GetEncoding("windows-1251");

If the recipient still cannot display the message correctly, please send us a screenshot of incorrectly displayed message. We will give you further advise.

The "Another operation is pending" exception is thrown when you call BeginXYZ method and then you call another method without calling the corresponding EndXYZ method. The exception is also thrown when you call a method from the second thread before a method called from the first thread is finished.

...