isBodyHtml is true and AlternateViews set, still no View Code option in Outlook 2010 using c#

StackOverflow https://stackoverflow.com/questions/19728621

سؤال

I have both .isBodyHtml=true and AlternativeViews option with one for text/html, but the View Code option in Outlook is still grayed out and not available for me to use.

My code:

var emailContent = "<html><body><b>this should be bold</b></body></html>";
var client = new SmtpClient("...", 25)
{
    Credentials = new NetworkCredential("...", "..."),
    EnableSsl = true
};
var msg = new MailMessage("...", toEmail, "subject", emailContent);
msg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(emailContent, new System.Net.Mime.ContentType("text/html")));
msg.IsBodyHtml = true;
client.Send(msg);

Note: I am using GMail's smtp, so I wonder if GMail is doing something to the headers saying, "hey, no one should be able to View Source in Outlook for gmail emails"? Thanks!

Edit: screenshot of grayed out View Code button in Outlook 2010: enter image description here

هل كانت مفيدة؟

المحلول

I believe what you want is actually the View Source command, not the View Code one. This is available by default under Message -> Move -> Actions -> Other Actions -> View Source.

View Source location

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top