8

我的 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

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

newMail.CC = "person1@domain1.org;person2@domain2.org;person3@domain3.org"

上面这条线有效!

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

4

1 回答 1

11

呼叫MailItem.Recipients.Add每个收件人或将//To属性设置为单独的地址列表。CCBCC";"

于 2012-07-03T16:46:01.877 回答