PowerShell Send Email to Multiple Recipients

One of my clients recently asked us to send the server log files via email to multiple recipients. So, I suggested using PowerShell’s Send-MailMessage cmdlet to send emails to multiple recipients.

In this tutorial, you’ll learn how to send emails to multiple recipients using PowerShell, how to include CC/BCC, attachments, and even how to use modern authentication methods.

Here, I will explain:

  • What Send-MailMessage is and how it works
  • How to send emails to multiple recipients (To, CC, and BCC)
  • How to attach files and send HTML emails
  • How to schedule automated email scripts
  • Modern alternatives to Send-MailMessage

Before you begin, ensure you have:

  • Windows PowerShell 5.1 or PowerShell 7+ installed
  • Access to an SMTP server (e.g., Gmail, Office 365, Exchange, or your organization’s mail server)
  • Valid email credentials (username and password)

Follow the steps below:

Step 1: Understanding the Send-MailMessage Cmdlet

The Send-MailMessage cmdlet is a built-in PowerShell command for sending emails via SMTP.

Basic Syntax:

Send-MailMessage -From "you@example.com" -To "user1@example.com" -Subject "Test Email" -Body "This is a test" -SmtpServer "smtp.example.com"

This simple command sends an email from one user to another. But what if you want to send to multiple recipients?

Step 2: Send Email to Multiple Recipients

You can specify multiple recipients in the -To, -Cc, or -Bcc parameters by separating addresses with commas.

Example:

Below is the complete PowerShell script.

# Define SMTP server and credentials
$smtp = "smtp.example.com"
$user = "bijay@powershellfaqs.com"
$pass = ConvertTo-SecureString "YourAccountPassword" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($user, $pass)

# List of recipients as an array
$recipients = @("bijay@powershellfaqs.com", "anotheremail@gmail.com")

# Send the email
Send-MailMessage -To $recipients -From $user -Subject "Weekly Report" -Body "Please find the attached report." -SmtpServer $smtp -Credential $cred -Port 587 -UseSsl

You can see the exact output in the screenshot below; it did send the email.

PowerShell Send Email to Multiple Recipients

Check out Monitor and Manage CPU Usage using Windows PowerShell

Step 3: Sending Attachments

Sometimes, you might need to send attachments while sending the emails.

You can attach one or more files using the -Attachments parameter. Here is the PowerShell script.

$To = "user1@company.com","user2@company.com"
$Attachments = "C:\Reports\Q1_Report.pdf","C:\Reports\Summary.xlsx"

Send-MailMessage `
  -From "reports@company.com" `
  -To $To `
  -Subject "Quarterly Reports" `
  -Body "Attached are the Q1 reports." `
  -Attachments $Attachments `
  -SmtpServer "smtp.office365.com" `
  -Port 587 `
  -UseSsl `
  -Credential (Get-Credential)

Step 4: Sending HTML Emails

You can make your emails look more professional by using HTML formatting.

$Body = @"
<h2 style='color:#2E86C1;'>Monthly Server Status</h2>
<p>All systems are <strong>operational</strong>.</p>
"@

Send-MailMessage `
  -From "monitor@company.com" `
  -To "admin@company.com","support@company.com" `
  -Subject "Server Status Report" `
  -Body $Body `
  -BodyAsHtml `
  -SmtpServer "smtp.company.com"

Step 5: Using Secure Credentials

Instead of hardcoding passwords, use Get-Credential for secure authentication:

$Cred = Get-Credential
Send-MailMessage -From "admin@company.com" -To "user@company.com" -Subject "Secure Email" -Body "This email uses credentials." -SmtpServer "smtp.office365.com" -Credential $Cred -UseSsl -Port 587

This ensures your credentials are entered securely at runtime.

Check out PowerShell Convert Secure String to Plain Text

Step 6: Automating Email Reports

You can schedule your PowerShell email script using Windows Task Scheduler.

  1. Save your script as Send-Report.ps1
  2. Open Task Scheduler → Create Task
  3. Set a trigger (e.g., daily at 8 AM)
  4. Set the action:powershell.exe -ExecutionPolicy Bypass -File "C:\Scripts\Send-Report.ps1"
  5. Save and run the task

Now your reports are sent automatically!

Step 7: Modern Alternatives to Send-MailMessage

⚠️ Note: Send-MailMessage is considered deprecated in newer PowerShell versions.

For modern and secure email automation, consider:

  • Graph API (for Microsoft 365)
  • MailKit or System.Net.Mail.SmtpClient (for .NET-based scripts)
  • SendGrid API (for cloud-based automation)

Example using MailKit:

Install-Module MailKit
Import-Module MailKit
Send-EmailMessage -From "you@domain.com" -To "team@domain.com" -Subject "Hello" -Body "This is a modern alternative!" -SmtpServer "smtp.office365.com"

Common Troubleshooting Tips

IssuePossible CauseSolution
Authentication failedWrong credentials or portVerify username/password and use -UseSsl -Port 587
Unable to connect to SMTP serverFirewall or server blockCheck network access and SMTP settings
Email not receivedSpam filtersWhitelist sender or check junk folder

Best Practices

  • Always use SSL/TLS for secure email transmission.
  • Avoid hardcoding passwords — use Get-Credential or encrypted credentials.
  • Use HTML for better email formatting.
  • Test your scripts in a non-production environment first.
  • Use logs to track email delivery success or failure.

With the examples above, you can now send emails to multiple recipients, include attachments, and even automate the process securely. Do let me know if you face any issues.

You may also like:

Leave a Comment

100 PowerShell cmdlets download free

100 POWERSHELL CMDLETS E-BOOK

FREE Download an eBook that contains 100 PowerShell cmdlets with complete script and examples.