
Can't get this MAPI script to work in vbscript
The following script is my attempt to convert David Yowell's MAPI script
(which works very well) from jscript into vbscript. Unfortunately this
wasn't too successful - the interpreter does not like the line:
set arrayRecipients = Recipients.split(";")
I get the message "object required". This is probably very simple but I
can't work it out.
Any ideas?
Thankyou
David Kanowski
******************************************************
Subject = "MySubject"
MessageText = "MyMessage"
MapiProfile = ""
if (MapiProfile = null) then
objShell = CreateObject ("WScript.Shell") ' to work in WSH and HTAs
MapiProfile = objShell.RegRead ("HKCU\Software\Microsoft\" +_
"Windows Messaging Subsystem\Profiles\DefaultProfile")
end if
set objMapi = Wscript.CreateObject("MAPI.Session")
objMapi.Logon(MapiProfile)
set objMsg = objMapi.Outbox.Messages.Add
objMsg.Subject = Subject
objMsg.Text = MessageText
set arrayRecipients = Recipients.split(";")
for i = 0 to arrayRecipients.length
objRecip = objMsg.Recipients.Add
objRecip.Name = arrayRecipients(i)
objRecip.Resolve
next
objMsg.Send