Solved

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

Posted on 2013-01-27
2
616 Views
Last Modified: 2013-01-29
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
Comment
Question by:Thaidog
2 Comments
 
LVL 69

Accepted Solution

by:
Qlemo earned 250 total points
ID: 38824900
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
 
LVL 40

Assisted Solution

by:Subsun
Subsun earned 250 total points
ID: 38825666
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problems with Microsoft.DHCP.PowerShell.Admin Module 4 56
upadting roles in SQL/oracle 8 26
Powershell Script Help 3 24
Help to build a Proc... 6 20
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
This article will help you understand what HashTables are and how to use them in PowerShell.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question