0

I want to convert an MSG file (Outlook mail message saved as a file) to an EML (RFC822) file. I'd also like to reverse the procedure and convert the resultant EML file back to MSG. From what I read, I can do this with Redemption via VBScript.

I don't have or desire to have Outlook installed, so I installed Microsoft Exchange Server MAPI Client and Collaboration Data Objects 1.2.1 on my Windows 64-bit machine as recommended on the Redemption page. I'm trying to run the following code:

Set session = CreateObject("Redemption.RDOSession")
Set msg = session.GetMessageFromMsgFile("c:\temp\mail.msg", false)
msg.SaveAs "c:\temp\mail.eml", 1024

I get an error that states "Wrong OS or OS version". The OS is 64-bit, and Redemption installed as 64-bit, so I'm guessing the standalone MAPI library installed as 32-bit.

Does anyone know if I can get this to work with Redemption? If not, does anyone have other suggestions to convert these file types without having Outlook installed?

Tony
  • 2,658
  • 2
  • 31
  • 46

1 Answers1

1

Your app bitness must match the bitness of the MAPI system, there is no way around that. See http://www.dimastr.com/redemption/faq.htm#ErrorCreatingRedemptionObject for details.
You can either install the 64 bit version of Outlook (any version) or compile your app in 32 bit (x86).
Keep in mind that the standalone version of MAPI does not handle Unicode MSG files.

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • Hi Dmitry, thanks for the reply. I'm using VBScript, so it's not compiling... it's running interpretively. – Tony Jun 13 '18 at 01:16
  • 1
    You can run the script using the 32 bit interpreter - run c:\Windows\SysWow64\cscript.exe – Dmitry Streblechenko Jun 13 '18 at 02:38
  • Hi Dmitry, that worked, thanks! I'm stuck on the EML to MSG now. What does redemption need to create a MAPIOBJECT from the _Microsoft Exchange Server MAPI Client and Collaboration Data Objects 1.2.1_? Perhaps I should open a new question? – Tony Jun 13 '18 at 19:16
  • MAPIOBJECT property points to an instance off the IMAPISession object. That object can only come from something that actually logs to some profile. Outlook can do that. Or RDOSession by calling Logon. The standalone version of MAPI is just a library, not a standalone app. It does nto create a MAPI session on its own. – Dmitry Streblechenko Jun 13 '18 at 19:49
  • And in case of conversion from MSG to EML, you don't really need a MAPI session unless you are trying to convert EX type addresses in the MSG file to SMTP. – Dmitry Streblechenko Jun 13 '18 at 19:50
  • So... are you saying Redemption can't create a MSG file from an EML file on this machine, or that I should figure out a way to do it with RDOSession.Logon? There is no profile on this machine. – Tony Jun 13 '18 at 21:01
  • What I am saying is that you don't need to set the MAPIOBJECT property or call Logon. What you have above is fine. – Dmitry Streblechenko Jun 13 '18 at 21:22