CreateItemFromTemplate only works with MSG / OFT files. For EML files, you need to either explicitly parse the file in your code, or use a third-party library (for example, Atonement):
The following code will create the MSG file and import the EML file into it using the Redemption ( RDOSession object):
set Session = CreateObject("Redemption.RDOSession") Session.MAPIOBJECT = outlookApp.Session.MAPIOBJECT set Msg = Session.CreateMessageFromMsgFile("C:\Temp\temp.msg") Msg.Import "C:\Temp\test.eml", 1024 Msg.Save MsgBox Msg.Subject
Then you can use the message ( RDOMail ) to get various properties to it (Subject, Body, etc.)
source share