Add HTML body to an email with Powershell -
i'm using powershell notify high number of users expiration date of document.
i have script prepared
$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 = i need include html content, or mht or bin outlook message format.
$smtp.send($msg) but email body preformatted using outlook, contains images, preformated text etc. best way include kind of content in message body??
thank you!
it should work if add body html string , add line:
$msg.isbodyhtml = true
Comments
Post a Comment