问题
I'm trying to send emails containing accents via powershell.
If i do the following :
$enc = [System.Text.Encoding]::UTF8
Send-MailMessage -to "Recipient@company.com" -from "Sender@company.com" -subject "test" -body "éèà" -Encoding $enc
It actually works and i get the accents fine in the mail.
BUT, if i do this :
$enc = [System.Text.Encoding]::UTF8
$Body = @"
éèà
"@
Send-MailMessage -to "Recipient@company.com" -from "Sender@company.com" -subject "test" -body $body -Encoding $enc
The email looks like this : éèÃ
I actually need to use the @" "@ quotes to send multiple lines mails.
Does anybody have a clue of how i could make this work ?
Thanks for your help !
回答1:
please try to execute this prior to your script :
$OutputEncoding = [Console]::OutputEncoding
来源:https://stackoverflow.com/questions/21454096/sending-email-containing-accent-with-powershell