Reload previously saved messages
' Example: CSMail VBScript Example 6
' Summary: Load all the messages we saved in Example 5
' Usage: cscript exvbs06.vbs
' or
' wscript exvbs06.vbs
' See the Microsoft Windows Scripting Host Documentation for details
' of the FileSystemObject model
Set fso=CreateObject("Scripting.FileSystemObject")
Set folder=fso.GetFolder("v:\inbox")
for each file in folder.files ' Iterate through the files
set MyMsg=CreateObject("CSMail.Message") ' Create the message object
MyMsg.LoadFromFile(file.Path)
wscript.echo MyMsg.Subject
for each section in MyMsg.Sections ' The sections property is a collection of
' all the sections (parts) of the message
if section.Filename<>"" then
wscript.echo section.Filename ' echo the filename
section.WriteBodyToFile("v:\attachments\"§ion.Filename)
' Save the attachment in a suitable place
end if
next
wscript.echo "Done!"
next
|