' Copyright (C) 2007 TechHit. All rights reserved. ' ' THIS SCRIPT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ' Option Explicit Sub Eml2Mbox(fileEml, fileMbox) dim strLine dim strFrom ' Set wshShell = WScript.CreateObject("WScript.Shell") ' strFrom = wshShell.ExpandEnvironmentStrings("From %TH_SENDER_EMAIL_ADDRESS%") ' fileMbox.WriteLine strFrom fileMbox.WriteLine "From - Tue Feb 20 11:11:11 2007" Do While Not fileEml.AtEndOfStream strLine = fileEml.ReadLine If InStr(strLine, "From ") = 1 Then strLine = ">" & strLine End If fileMbox.WriteLine strLine Loop fileMbox.WriteLine End Sub Dim fso, fileEml, fileMbox, wshShell, strFile, strMessage If WScript.Arguments.Count < 1 Then WScript.Echo("Usage: exec_outlook_to_mbox.vbs message.txt") WScript.Quit End If strFile = Wscript.Arguments(0) Set fso = CreateObject("Scripting.FileSystemObject") ' Open the current message Set fileEml = fso.OpenTextFile(strFile, 1) ' Open the output file, creating if it does not exist, and write the line into it. Set fileMbox = fso.OpenTextFile("c:\outlook.mbox", 8, True) 'Write the message into the mbox Eml2Mbox fileEml, fileMbox ' Close the files fileEml.Close fileMbox.Close Set fileEml = Nothing Set fileMbox = Nothing Set fso = Nothing Set wshShell = Nothing