06-17-2009, 03:12 PM
This is a script for reading an email from outlook inbox, and copying it to a notepad file and deleting that particular mail from inbox
Code:
Set MailItem = createobject("outlook.application")
Set mailfolder = MailItem.GetNameSpace("Mapi").pickfolder
Set fo = createobject("scripting.filesystemobject")
Set f = fo.createtextfile(<filepath>)
f.writeline "Sender: "&mailfolder.items(1).sendername
f.writeline ""
f.writeline "Subject: "&mailfolder.items(1).subject
f.writeline ""
f.writeline "Sent On: "&mailfolder.items(1).senton
f.writeline ""
f.writeline "Body: "&vbcrlf&mailfolder.items(1).body
mailfolder.items(1).delete