Bobby Dore
Bobby Dore

Reputation: 863

How do I use the Outlook Object Model to set the encoding for a single outbound email?

I am using the Outlook object model to send messaegs and some have Japanese characters. The recipient receives them as letters and numbers so I'd like to send these messages using utf-8 encoding. I can configure this for all messages in Outlook Advanced options but would prefer not to change that setting whenever I need to do this (I leave at Western European ISO normally).

How do I create a message and set the encoding? I tried using the InternetCodePage value but that didn't work. The value would be set to 65001 as shown below but as soon as I set the htmlbody property, the value would change to ASCII.

I'm using PowerShell and welcome ideas.

$Mail = $Outlook.CreateItem(0) 
$mail.InternetCodepage = "65001"
$Mail.HTMLBody = $HTMLWithJapaneseCharacters    

Upvotes: 0

Views: 537

Answers (1)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66255

Instead of relying on the right code page for the whole email, all Unicode characters inside the HTML body must be HTML-encoded.

Upvotes: 1

Related Questions