powershellemailspecial-characters

Powershell send-MailMessage to include trademark in the body


My PS script is sending email but changes the trademark and registered symbol to a question mark.

$body = "<b>A program™ has sent this email® . </b>"

Send-MailMessage -smtpServer mail.com  -Subject "test" -BodyAsHtml  $body 

Output is A program? has sent this email? .

How can I get the symbols in the output email?


Solution

  • Easiest wasy to fix this: because you are sending a HTML body you can simply replace the symbols with &copy; for © and &trade; for ™.