使用Powershell将HTML正文添加到电子邮件
我正在使用powershell通知大量用户文档的过期日期 我已经准备好剧本了使用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
$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?