Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Trouble adding Message body as HTML

$
0
0

Hi,

I'm trying to add an htm file to an email message as the body but instead I'm getting the results all in black and not properly formatted.

Here is the code:

$msg = new-object Net.Mail.MailMessage
$smtp = new-object Net.Mail.SmtpClient($smtpHost)
$msg.From = $from
$msg.To.Add($Recipient)
$msg.Subject = $Title
$msg.Body = Get-Content $FilePath | Out-String
$msg.IsBodyHTML
$smtp.Send($msg)

Thanks


Viewing all articles
Browse latest Browse all 6937

Trending Articles