Powershell HTML不格式化

时间:2017-10-31 16:38:44

标签: powershell parsing html-parsing

我有一个脚本,其中包含以下行:

$body += "The file " + $item.Name + " is reaching $MaxSize GB! <br> Current Size: <b>" + $SizeInGb.ToString(".00") + " GB </b> <br />"+ "Path to file: " + $Path + "<br /> <br />" 

问题是我的HTML无法呈现/解析(在Outlook中)<​​/ p>

我的邮件仍显示为:

The file SRV20150818.VHD.ebxwyq is reaching 2 GB! <br> Current Size: <b>36,64 GB </b> <br />Path to file: \\srv641\Software G\update\ex\SRV565456.VHD.wyq<br /> <br />

这是为什么?

我用来发送邮件的命令是:

Send-MailMessage -To "test@ds.test" -From "tesbetest@test.test" -Subject $subject -Body $body -SmtpServer 192.168.16.18

1 个答案:

答案 0 :(得分:4)

您需要在Send-MailMessage中包含-BodyAsHtml

Send-MailMessage -To "test@ds.test" -From "tesbetest@test.test" -Subject $subject -Body $body -BodyAsHtml -SmtpServer 192.168.16.18