Monday, October 1, 2007

VBScript - Outlook - Send message from text file

'Script start


Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(0)
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile ("C:\Documents and Settings\murugan1\Desktop\mailsg.txt", ForReading)
strNextLine = objTextFile.Readall
wscript.echo StrNextLine
With objOutlookMsg
.To = InputBox("Enter To field")
.Subject = InputBox("Enter Subject")
.Body = strNextLine
.Send
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing



'Script End


Queries on customization. Open Orangescripts.blogspot.com and post it .

No comments: