Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending mail to multiple people

Status
Not open for further replies.

collierd

MIS
Dec 19, 2001
509
DE
Hello

Can anybody help with he following:

I have generated a piece of vbscript which successfully sends mail to one individual (of importance):

Code:
Set objOutlk = createobject("Outlook.Application")
Set objMail = objOutlk.createitem(0)
objMail.To = MailTo
objMail.subject = MailSubject
objMail.body = MailBody
objMail.send

Where MailTo, MailSubject and Mailbody are populated with relevant detail

How do I expand this to send the message to multiple individuals

Thanks

Damian.
 
objMail.To = "joe@hotmail.com;Jack@Yahoo.com;Bob@lycos.com"

separate addresses with a semicolon.
 
Damian

If you had 3 users Fred, Bob and Pete then I would use something like this:

Dim Users(2)
Users(0) = "Fred@test.com"
Users(1) = "Bob@test.com"
Users(2) = "Pete@test.com"

For i = 0 to 2
Set objOutlk = createobject("Outlook.Application")
Set objMail = objOutlk.createitem(0)
objMail.To = Users(i)
objMail.subject = MailSubject
objMail.body = MailBody
objMail.send
Next


There are many other ways of populating the initial array but this should give you an idea.

-Sunny

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top