我想讓我的文本正文轉換爲HTML,因此它不顯示爲我的電子郵件中的純文本。正文轉換爲HTML不工作
下面是代碼
$From = ""
$To = ""
$SMTPServer = ""
$SMTPPort = "587"
$Username = ""
$Password = ""
$subject = "Test Powershell"
$body = $htmlreport
$bodyAsHtml = $true
$smtp = New-Object System.Net.Mail.SmtpClient($SMTPServer, $SMTPPort);
$smtp.EnableSSL = $true
$smtp.Credentials = New-Object System.Net.NetworkCredential($Username, $Password);
$smtp.Send($From, $To, $subject, $body);
我不能見得到的報告發送爲HTML。
沒有這裏有足夠的信息,你沒有包含你想要轉換的文本,你沒有顯示'$ htmlreport'包含的內容。另外,創建一個名爲'$ bodyAsHtml'的變量並將其設置爲true將毫無用處。 – arco444