使用vbscript向多个收件人发送电子邮件

dup*_*per 7 vbscript mapi outlook

我的vbscript会自动向收件人发送电子邮件,但是有人知道如何向其中添加多个收件人吗?

...
Dim ToAddress
Dim FromAddress
Dim MessageSubject
Dim MyTime
Dim MessageBody
Dim MessageAttachment
Dim ol, ns, newMail
MyTime = Now

ToAddress = "email@address.com"
MessageSubject = "It works!."
MessageBody = "Good job on that script." 
MessageAttachment = some attachment
Set ol = WScript.CreateObject("Outlook.Application")
Set ns = ol.getNamespace("MAPI")
Set newMail = ol.CreateItem(olMailItem)
newMail.Subject = MessageSubject
newMail.Body = MessageBody & vbCrLf & MyTime
newMail.RecipIents.Add(ToAddress)
newMail.Attachments.Add(MessageAttachment)
newMail.Send
Run Code Online (Sandbox Code Playgroud)

这就是我现在所拥有的.它工作正常.但是,我想拥有多个收件人.提前致谢.

newMail.CC = "person1@domain1.org;person2@domain2.org;person3@domain3.org"
Run Code Online (Sandbox Code Playgroud)

以上这条线工作了!

它与.BCC的工作方式相同,以防有人想要不显示联系人列表.

Dmi*_*nko 10

为每个收件人调用MailItem.Recipients.Add或将To/CC/BCC属性设置为";" 分开的地址列表.