Read all messages on a Pop3 Server and then save all the messages to disk files
' Example: CSMail VBScript Example 5
' Summary: Read all messages on a Pop3 Server and then save all the messages to disk files
' Usage: cscript exvbs05.vbs
' or
' wscript exvbs05.vbs
set pop=CreateObject("csmail.Pop3client") ' Create a Pop3Client Object
call pop.Connect("localhost","myusername","secret")
' and connect to the server
wscript.echo "Retrieving Messages..."
call pop.RetrieveMessages ' Get all the messages on the server
wscript.echo "Done..."
pop.Close(true) ' Close the connection to the server
' (and delete the messages on the server)
' Now we iterate through all the messages
for each msg in pop.Messages ' The messages property is a collection of
' all the messages we retrieved
wscript.echo msg.UIDL
msg.SaveToFile "v:\inbox\"&msg.UIDL ' Save the message to a suitable location
next
|