I have this powershell script to sending emails with attachments, but when I add multiple recipients, only the first one gets the message. I\'ve read the documentation and s
here is a full (gmail) and simple solution... just use normal ; delimiter.. best for passing in as params.
$to = "user1@domain.org;user2@domain.org"
$user = "italerts@domain.org"
$pass = ConvertTo-SecureString -String "pass" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential $user, $pass
$mailParam = @{
To = $to.Split(';')
From = "IT Alerts <italerts@domain.org>"
Subject = "test"
Body = "test"
SmtpServer = "smtp.gmail.com"
Port = 587
Credential = $cred
}
Send-MailMessage @mailParam -UseSsl