0
我想從.html文件(外部生成)中將HTML表格嵌入到使用PowerShell中的SendMail的電子郵件中。我的代碼如下:SendMail Powershell - 嵌入.html文件
$userid = '[email protected]'
$creds = Get-Credential $userid
$port = 587
$smtp = "smtp.office365.com"
$to = "[email protected]"
$from = $userid
$subject = "FX summary report"
$body = Get-Content ("C:\Users\xxx\Documents\R\newtrend.table.html")
$body = $body | out-string
Send-MailMessage -To $to -Subject $subject -Body $body -UseSsl -Port $port -SmtpServer $smtp -From $from -Credential $creds
但是,這並沒有嵌入html代碼,而是我得到了html文本編寫。我的電子郵件看起來像:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
....
我不熟悉powershell,我真的很感激解決方法。