Problème encodage (caractères spéciaux)
Bonjour
J'ai besoin de faire un script qui envoie des mails. J'ai un problème d'encodage.
Du coup, j'ai fait un script tout simple qui envoie juste un mail, après avoir fait des recherches sur la toile.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Add-PSSnapIn Microsoft.SharePoint.PowerShell
clear-host
[string]$dateLog = get-date -format "yyyyMMdd_HHmmss"
[string]$ParamLogFile = "C:\Batchs\LOGS\testMail_" +$dateLog+".log"
MessageLog("START")
$EmailTo = "mondestinataire@mondomaine.com"
$EmailFrom = "monexpediteur@mondomaine.com"
$Subject = "test caractères spéciaux"
$HtmlBody = "voici le body avec des caractères spéciaux"
$SmtpHost = "**.**.**.**"
MessageLog("EmailTo="+$EmailTo)
MessageLog("EmailFrom="+$EmailFrom)
MessageLog("Subject="+ $Subject)
MessageLog("HtmlBody="+$HtmlBody)
MessageLog("SmtpHost="+$SmtpHost)
$encoding = [System.Text.Encoding]::UTF8
Send-MailMessage -To $EmailTo -From $EmailFrom -Subject $Subject -Body $HtmlBody -BodyAsHtml -Encoding $encoding -SmtpServer $SmtpHost
MessageLog("END") |
et ben ca marche pas !!! :-(
titre : test caractères spéciaux
body : voici le body avec des caractères spéciaux
ou est-ce que j'ai merdé chef ?