I had a small a simple one to share a co-worker ran into

He had a simple script designed to email users about a password expiry but every time he ran it , the French Characters were swapped out with “?”

If you ever need to send Accents using Send-MailMessage there is a parameter called “Encoding”

Now in PowerShell 5 it seems to accept it like this quite happily

-encoding UTF8

This will allow those accents to happily pass through.

However in earlier versions you’ll need to set up the parameter as a .NET object like this

-encoding [system.text.encoding]::UTF8

A minor change to solve a major problem Smile

Cheers!

Sean – the Energized Tech

Advertisements