How to create an Outlook .msg file with Redemption C# that has an HTML body?

0

I can't seem to get any formatting when creating a HTML format .msg file. The text shows up in the body but the HTML formatting is not applied. Any suggestions?

RDOSession rdoSession = new RDOSession();
rdoSession.Logon();

// Start with a seed.msg
File.Copy(@".\seed.msg", @".\test.msg", true);
RDOMail rdoMail = rdoSession.GetMessageFromMsgFile(@".\test.msg", false);
// Set body format to HTML
rdoMail.BodyFormat = 2;
rdoMail.Subject = "HTML format test";
rdoMail.HTMLBody = "<html><body><b>bold</b> text</body></html>";
// PR_InetMailOverrideFormat  
rdoMail.set_Fields(0x59020003, 0x00020000 | 0x00100000 | 0x00040000);
// PR_MSG_EDITOR_FORMAT
rdoMail.set_Fields(0x59090003, 2);
rdoMail.Save();
outlook-redemption
asked on Stack Overflow Jun 16, 2020 by Ray Newman

1 Answer

0

It looks like you are opening an existing MSG file. I had no problem with the following script executed from OutlookSpy (click “Script Editor” button on the OutlookSpy toolbar, paste the script, click Run):

set Session = CreateObject("Redemption.RDOSession")
set rdoMail = Session.CreateMessageFromMsgFile("c:\temp\html.msg")
rdoMail.Subject = "HTML format test"
rdoMail.HTMLBody = "<html><body><b>bold</b> text</body></html>"
rdoMail.Save

User contributions licensed under CC BY-SA 3.0