Sending Emails with Special Characters

Share |

Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Powershell Plus

13 Free SQL Tools from Idera

Free Ebook: Mastering Powershell


PowerShell has built-in support for sending emails: Send-MailMessage! All you need is an SMTP server. However, with standard encoding you may run into issues where special characters are mangled. Use the -Encoding parameter and specify UTF8 to preserve such characters. Here's a sample with a German freemailer

Send-MailMessage -Body 'I can send special characters: äöüß' -From -to -Credential (Get-Credential -SmtpServer -Subject 'Sending Mail From PowerShell' -Encoding ([System.Text.Encoding]::UTF8)

Twitter This Tip! ReTweet this Tip!

Posted Jan 23 2012, 06:00 AM by ps1
Copyright 2012 All rights reserved.