[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 639
  • Last Modified:

How would I add another email recipient to this powershell script?

How would I add another email recipient to this powershell script?

$ol = New-Object -comObject Outlook.Application
$mail = $ol.CreateItem(0)
$Mail.Recipients.Add("me@email.com")
$Mail.Subject = "Report"
$Mail.Body = "
Hi there!
"
$Mail.Send()

Open in new window

0
Thaidog
Asked:
Thaidog
2 Solutions
 
QlemoC++ DeveloperCommented:
ol = New-Object -comObject Outlook.Application
$mail = $ol.CreateItem(0)
$Mail.Recipients.Add("me@email.com")
$Mail.Recipients.Add("mini-me@email.com")
$Mail.Subject = "Report"
$Mail.Body = "
Hi there!
"
$Mail.Send()

Open in new window

0
 
SubsunCommented:
I case, If you want to add multiple recipient in single line..
replace
$Mail.Recipients.Add("me@email.com")

with

$Mail.to = "me@email.com;me2@email.com;me2@email.com;me3@email.com"
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now