I've been trying to get this to work for a while now, and so far I've found lots of people saying it's a bug or it's a feature etc. But no-one really seems to have come up with a solution.
I've started using powershell (v2 admittedly, although I never had this problem with VBS, or any other language I've worked with) and when I send an email e.g. :
Send-mailmessage -to "[email protected]" -from "[email protected]" -subject "theSubject"
what I get back in place of my subject is:
=?us-ascii?Q?theSubject?=
What is this and why does powershell do it? It means that none of our in house applications accept email input from powershell at present.
I've tried -Encoding ([System.Text.Encoding]::ASCII), that made no difference.
Can anyone suggest a fix for this before I give up on powershell (which would be a shame because up until now I've been quite impressed).
EBGreen - My Actual code (taken straight from my script - names changed) is:
$cfg_Address = "[email protected]" $cfg_Subject = "emailTest" $cfg_FromAddress = "[email protected]" $cfg_SMTP = "123.12.1.12" Send-MailMessage -to "$cfg_Address" ` -From "$cfg_FromAddress" ` -Subject "$cfg_Subject" ` -SmtpServer "$cfg_SMTP" Matt - My EMail client is a custom built in house application that strips the internet headers and compares them to a set of rules to determine what to do. Looking at the same email in Outlook the subject is displayed correctly. But when I look at the headers it says:
Subject: =?us-ascii?Q?emailTest?= I ran a test and quickly mocked up the same email script using VBS (same To, From, Subject), and sent that to myself. Looking at the internet header for that one I get:
Subject: emailtest
-Encoding ([System.Text.Encoding]::ASCII)shouldn't make any difference since the default encoding is ASCII.