I'm trying to figure out how to best use Powershell to send email. I've been struggling with single quote ' and dashes - turning into question marks ? in the sent email and wondering if someone can help. This is what I have:
##############################################################################
$Letter = Get-Content .\Letter.htm
$From = "Myaddress@email.com"
$To = address@email.com
$Cc = "MyOtherAddress@email.com"
$Subject = "Subject"
$Body = @"$Name,
$Letter
"@
$SMTPServer = "smtp.gmail.com"
$SMTPPort = "587"
Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject `
-Body $Body -SmtpServer $SMTPServer -port $SMTPPort -UseSsl -BodyAsHtml -Credential $Credential
##############################################################################
I have also tried:
$Letter = Get-Content .\Letter.htm -Raw