I am using powershell to send an SMTP mail. The body of the email is from a file. The problem is, when I receive this email, it removes all spaces and linefeeds so it looks ugly.
Outlook client is no removing linebreaks.
My code is as follows:
$smtpserver = "smtpserver"
$from="[email protected]"
$to="[email protected]"
$subject="something"
$body= (Get-Content $OutputFile )
$mailer = new-object Net.Mail.SMTPclient($smtpserver)
$msg = new-object Net.Mail.MailMessage($from,$to,$subject,$body)
$msg.IsBodyHTML = $true
$mailer.send($msg)
I have even tried to use get-content with -encoding ASCII and couple of others but no help. Can anyone please help?
-
thanks