I've the below code to retrieve the content from a text and then email it out as HTML. However, the replacement on the carriage returns or new lines is not working and hence my email becomes a continuous wall of text without any new lines.
Can advise where I am wrong? I just want to replace all the line breaks to to HTML <br> tags.
$subject = "Batch Job Error : CMSDailyReminder"
$body = "Excution Date : "+$StartTime
$body += "<br><br>" + $errorContent
$body = $body -replace "`r`n", "<br>"
send-MailMessage -SmtpServer $smtp -To $spAdminEmail -From $from -Subject $subject -Body $body -BodyAsHtml -Priority High