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 Message
class inherits from .NET's MailMessage
class try using it's BodyEncoding
property and set it to System.Text.Encoding.UTF8
, for example:
commomMessage.BodyEncoding = System.Text.Encoding.UTF8;
If Message
class doesn't inherit from MailMessage
try 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.