Soldato
So I've set up a script which basically pulls data from a sql table and then based on certain conditions will then send out a mail notification. Historically I set this up to only send to a single recipient but now need top expand this via the "Send-MailMessage" cmdlet.
With this in mind I altered the sql table which stores the recipients as a single string in the following format (Write-Host confirms this):
The data does get pulled in correctly as a variabe
However when I pass this via the Send-Mailmessage cmdlet
Send-MailMessage balks with
I must assume it does not like the format passed with $mailrecipients but various web checks suggest it is good.
Any help/pointers much appreciated.
TIA, Paul.
With this in mind I altered the sql table which stores the recipients as a single string in the following format (Write-Host confirms this):
Code:
"<[email protected]>","<[email protected]>","<[email protected]>"
Code:
$mailrecipients = $item.mailrecipients
Code:
Send-MailMessage -To $mailrecipients -From "[email protected]" -Priority Low -Subject "foosubject" -Body "foobody" -smtpServer 1.2.3.4
Code:
Send-MailMessage : An invalid character was found in the mail header: '"'....
Send-MailMessage : A recipient must be specified.
Any help/pointers much appreciated.
TIA, Paul.
Last edited: