I use the mailsystem.NET library to put a message in my inbox. This is my code:
Imap4Client imap = new Imap4Client();
imap.ConnectSsl("imap.gmail.com", 993);
imap.Login(mylogin, mypassword);
Mailbox mails;
mails = imap.SelectMailbox("INBOX");
Message commomMessage = new Message();
commomMessage.From = new Address("someAddress", "someName");
commomMessage.To.Add(mylogin, "myName");
commomMessage.Subject = "someSubject";
commomMessage.BodyHtml.Text = "Привет мир";//or some cyrillic text
commomMessage.Date = DateTime.Now;
mails.Append(commomMessage);
When I open my gmail inbox, I see this mail, but the body contains ????? ??? rather than “привет мир”. If commomMessage.BodyHtml.Text contains only Latin characters, there is no problem.
If
Messageclass inherits from .NET’sMailMessageclass try using it’sBodyEncodingproperty and set it toSystem.Text.Encoding.UTF8, for example:If
Messageclass doesn’t inherit fromMailMessagetry to find other way of setting the appropriate encoding for your e-mail message. I believe it’s the issue that you can fix by using UTF8 encoding.