Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending emails to multiple recipients using vbscript

My vbscript sends email to automatically to a recipient, but does anyone know how to add more than one recipient to it?

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

ToAddress = "[email protected]"
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

This is what I have right now. And it works fine. But, I'd like to have more than one recipients. Thanks in advance.

newMail.CC = "[email protected];[email protected];[email protected]"

This above line worked!

And it works the same way with .BCC, in case anyone wants to not to display the contacts' list.

like image 881
duper Avatar asked Jul 03 '12 16:07

duper


People also ask

How to send email to multiple recipients using vbscript?

Call MailItem. Recipients. Add for each recipient or set the To / CC / BCC properties to a ";" separated list of addresses.

How do I send an email to multiple receivers?

You can send a mass email to more than one recipient using the BCC feature. Click the compose box, after composing your message, click on BCC and add all your recipients. This will send the emails to the recipients keeping email addresses hidden from each other.

How do I send multiple emails in SMTP?

For smtp you need to have port number, logon email address and in To:"[email protected];[email protected]" …

How do I send multiple emails in Webmail?

At first sight, sending multiple emails is a pretty easy task. You just need to open your webmail or your client, compose the message, put all the addresses in the “Bcc:” form (Blank Carbon Copy, to keep them hidden), and hit send.


1 Answers

Call MailItem.Recipients.Add for each recipient or set the To/CC/BCC properties to a ";" separated list of addresses.

like image 110
Dmitry Streblechenko Avatar answered Sep 30 '22 02:09

Dmitry Streblechenko