Reputation: 703
I'm writing an add-in for Outlook 2007. Everything works fine except when I send an email in HTML format, Outlook converts it to RTF. So if the recipient opens it in eg. Thunderbird he gets a wonky looking text message instead of the nicely formatted html I sent.
Outlook.MailItem theMail = (Outlook.MailItem)((Outlook.Application)Globals.ThisAddIn.Application).CreateItem(Outlook.OlItemType.olMailItem);
Outlook.Recipient rcp = theMail.Recipients.Add("joe blow <[email protected]>");
rcp.Type = (int)Outlook.OlMailRecipientType.olTo;
theMail.HTMLBody = <html composed elsewhere>
theMail.BodyFormat = Outlook.OlBodyFormat.olFormatHTML;
How do I convince Outlook that I really do want html?
EDIT OK - I found the problem here at MSDN I'm adding a user property
Outlook.UserProperty prop = theMail.UserProperties.Add("theQuoteId", Outlook.OlUserPropertyType.olText);
prop.Value = quote.qid.ToString();
According to the article the property cannot be mapped to the mime headers and Outlook throws it into RTF.
So my next problem is to figure out how to add an unique tag to the message so I can link it to a database later. Any ideas?
Upvotes: 2
Views: 1065
Reputation: 66215
Look at the Outlook message in the Sent Items folder with OutlookSpy (I am its author - click IMessage button) to see if the UseTnef
named property (DASL name http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8582000B
) is set to true.
It can be set if user properties are set on the message - since they cannot be preserved in MIME alone, Outlook sends in the RTF format (the infamous winmail.dat attachment).
Upvotes: 1
Reputation: 4007
I had this problem a few years ago. In the end we fixed it with an Outlook hot fix, not a code change.
Upvotes: 1