Hey, hope someone can give me some advice on a weird issue i've encountered.
I'm trying to send emails that contains swedish symbols using send-mailmessage in powershell 4.0. This works as intended when I run the command in a powershell console window but when I run the same cmdlet in a .ps1 file the swedish characters turn to gibberish.
Send-MailMessage -subject 'Testing special characters: Å Ä Ö' -Body 'testing Å Ä Ö åäö' -to $to -from $from -encoding UTF7 -smtpserver $smtpserver
The resulting mail when ran in ps1 file has the following body:
testing Ã…Ã„Ã– Ã¥Ã¤Ã¶
I then tried the .ps1 file on a win2008R2 server that has powershell 3.0 installed, and from this machine the email arrived correctly formatted.
Have I encountered a bug in PS 4.0 or am I missing something obvious here?
Thanks Martin, I tried it on a windows 2012 r2 server with 4.0 installed and can't replicate it there either.
That line is all my script file contains at the moment in order to make sure there was nothing else that could cause this.
I'll run this script from the 2012 server but it makes me frustrated when I can't figure out why it's working differently on my client 🙂