我使用PowerShell通过西班牙语脚本从Windows Server 2008 R2发送电子邮件,但文本显示不正确。
这是mi代码:
$file = "c:\Contenido-Mail.txt"
if (test-path $file)
{
$from = "afgarciact@gmail.com"
$to = "<itmanager@credivalores.com>"
#Las direcciones del to deben indicarse con signos de mayor que
#y menor que.
$pc = get-content env:computername
$subject = "Mesaje de prueba del servidor " + $pc
$smtpserver ="192.168.4.133"
#Con Out-String formateamos el texto
$body = Get-Content $file | Out-String
foreach ($recipient in $to)
{
write-host "Enviando mail a $to"
Send-MailMessage -smtpServer $smtpserver -from $from -to $recipient -subject $subject -body $body
}
}
else
{
write-host "Configuración"
}
这是身体:
Juego de tronos(权力的游戏)es una seriedetelevisión
以下是Outlook客户端的样子:
Juego de tronos(权力的游戏)和电视节目
你认为我做错了吗?
答案 0 :(得分:0)
假设您的文本文档编码为UTF8,请尝试:
{{1}}