Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Powershell将HTML正文添加到电子邮件_Html_Email_Powershell_Outlook_Smtp - Fatal编程技术网

使用Powershell将HTML正文添加到电子邮件

使用Powershell将HTML正文添加到电子邮件,html,email,powershell,outlook,smtp,Html,Email,Powershell,Outlook,Smtp,我正在使用powershell通知大量用户文档的过期日期 我已经准备好剧本了 $smtpServer = "xxxxx.contoso.com" $msg = new-object Net.Mail.MailMessage $smtp = new-object Net.Mail.SmtpClient($smtpServer) $msg.From = New-Object Net.Mail.mailaddress "xxxx@contoso.es", "xxx yyy zzz" $msg

我正在使用powershell通知大量用户文档的过期日期

我已经准备好剧本了

 $smtpServer = "xxxxx.contoso.com"
 $msg = new-object Net.Mail.MailMessage
 $smtp = new-object Net.Mail.SmtpClient($smtpServer)
 $msg.From = New-Object Net.Mail.mailaddress "xxxx@contoso.es", "xxx yyy zzz"
 $msg.ReplyTo = "no-reply@contoso.es"
 $msg.To.Add("xxx@contoso.es")
 $msg.bcc.add($bcc)
 $msg.subject = "Expiration notification"
$msg.body=我需要将HTML内容或MHT或bin作为outlook邮件格式。

 $smtp.Send($msg)
但是电子邮件正文是使用outlook预先格式化的,因此它包含图像、预先格式化的文本等。这将是在邮件正文中包含此类内容的最佳方式


谢谢大家!

如果将正文作为html字符串添加,并添加以下行,则应该可以:

$msg.IsBodyHTML = true

它不仅是一个html文件,而且是一个包含图像的文件夹。。。不管怎样,它还能工作吗@ben?