none
emails created by 3rd party app in outlook are plain text not html since build 8201.2075 RRS feed

  • Question

  • Hello, we have a .NET application which creates emails from .oft template files into outlook via the Microsoft.Office.Interop.Outlook.dll.

    However since version 1705 / build 16.0.8201.2075 the emails are now converted to plain text -  all the HTML formatting disappears.

    I've googled this as I thought it would be a pretty common problem, but can't find any references to it.

    Currently i've just rolled back my office365 install to version 1704 / build 16.0.8067.2157 and it's cured it but i would like a longer term fix!

    Friday, July 14, 2017 8:54 AM

All replies

  • Hi,

    I notice that the issue happens to the emails created via the Microsoft.Office.Interop.Outlook.dll. This forum focuses on the general discussion for Outlook features and deployment.

    Therefore, I would move the thread to Outlook for developers forum for more help:

    https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=outlookdev 

    Best Regards,

    Winnie Liang


    Please remember to mark the replies as answers if they help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, July 17, 2017 3:04 AM
  • What is the relevant snippet of your ciode that creates messages?

    What kind of message store is it (PST, IMAP4, Exchange, etc.)?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Monday, July 17, 2017 4:33 AM
  • Hi DickMac,

    currently I am available with click to run version of Outlook.

    I try to make a test with code below.

     private void button1_Click(object sender, EventArgs e)
            {
                Outlook.Application app = new Outlook.Application();
                Outlook.MailItem mailItem = app.CreateItem(Outlook.OlItemType.olMailItem);
                mailItem.Subject = "This is the subject";
                mailItem.To = "abc@xyz.com";
               // mailItem.Body = "This is the message.";
                mailItem.Importance = Outlook.OlImportance.olImportanceHigh;
                mailItem.HTMLBody = "<h1>This is the message.</h1>";
               // mailItem.Display(true);
                mailItem.Send();
    
            }

    when I receive the mail , I can see that it uses the HTML format.

    Output:

    you can try to make a test with code above and let us know about the results.

    also you can try to post your code , so that we can make a test with it on our side.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, July 18, 2017 1:02 AM
    Moderator
  • Hello Dmitry,

    This is the code: 

    Microsoft.Office.Interop.Outlook.Application application = new Microsoft.Office.Interop.Outlook.Application();

    Microsoft.Office.Interop.Outlook.MailItem mail = application.CreateItemFromTemplate(@"F:\Emails\Test.oft") as Microsoft.Office.Interop.Outlook.MailItem;

    mail.UnRead = true;

    mail.Display();

    It's an exchange .ost store.  We've worked out it must be a bug in outlook 2016.  If i take one of the problem templates, send it to myself, then re-save it as a template (.oft) then it works ok.  However if i edit anything before i save, it messes it up. 

    You will only recreate the problem if your test email has HTML elements such as pictures or hyperlinks etc.

    Friday, July 21, 2017 3:18 PM
  • Hello Deepak,

    The problem is when an email is created from an existing .oft template using this code:

    Microsoft.Office.Interop.Outlook.Application application = new Microsoft.Office.Interop.Outlook.Application();

    Microsoft.Office.Interop.Outlook.MailItem mail = application.CreateItemFromTemplate(@"F:\Emails\Test.oft") as Microsoft.Office.Interop.Outlook.MailItem;

    mail.UnRead = true;

    mail.Display();

    And the html must have elements such as pictures or hyperlinks to see the problem,  plain text is not affected.

    Friday, July 21, 2017 3:20 PM
  • Hi DickMac,

    I try to reproduce the issue and I find that I get the same output like you.

    it display the plain text without any HTML formatting and images.

    I try to write same code in VBA and find that I get same output.

    then I try to create .msg file and use code below.

    Sub demo()
    Dim otlApp, otlNewMail As Object
    Dim vTemplateBody, vTemplateSubject As String
    Set otlApp = CreateObject("Outlook.Application")
    Set otlNewMail = otlApp.CreateItemFromTemplate("C:\Users\v-padee\Desktop\demo template.msg")
    With otlNewMail
    vTemplateBody = otlNewMail.HTMLBody
    vTemplateSubject = otlNewMail.Subject
    .Close 1
    End With
    
    Set otlApp = CreateObject("Outlook.Application")
    Set otlNewMail = otlApp.CreateItem(0)
    With otlNewMail
    .Display
    .SentOnBehalfOfName = "deep"
    .BCC = ""
    .Subject = vTemplateSubject
    .HTMLBody = vTemplateBody
    End With
    End Sub

    Output:

    so you can try to convert this VBA code to C# code and try to make a test with .MSG file.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, July 24, 2017 3:27 AM
    Moderator