CDOSYS and Japanese Email

  • Thread starter Thread starter Avram Grossman
  • Start date Start date
A

Avram Grossman

I am using the classic examples from MSDN on CDOSYS and need to send a
message body formatted with HTML and contains Japanese characters. The body
tag in the HTML sets the character encoding using < meta
http-equiv="Content-Type" content="text/html; charset=iso-2022-jp" >. The
received message encoding is in Western ISO, not iso-2022-jp and therefore
not viewed in Japanese. If you switch the browser to display japanese
encoding, the message is displayed in Japanese just fine.

I've tried every combination and permutation I can find.
------------------------------------------------------------------
Function SendCDOSYS(sTo, sFrom, sCC, sSubject, sMessage)
Dim iConf
Dim iMsg
Dim Flds
Set iConf = CreateObject("CDO.Configuration")
Set iMsg = CreateObject("CDO.Message")
Set Flds = iConf.Fields
Flds(cdoSendUsingMethod) = cdoSendUsingPort
Flds(cdoSMTPServer) = "mail.MyEmailServer.com"
Flds(cdoSMTPServerPort) = 25
Flds(cdoSMTPAuthenticate) = cdoAnonymous ' 0
Flds(cdoLanguageCode).Value = "JA" 'This line seems to not make a
difference
Flds.Update

With iMsg
Set .Configuration = iConf
.MimeFormatted = true
.AutoGenerateTextBody = True
' Build Message Header
.To = sTo
.From = "(e-mail address removed)"
.Subject = sSubject
' Build Message content
.HTMLBody = sMessage
If InStr(sMessage,"shift_jis") > 0 OR InStr(sMessage,"iso-2022-jp")
.BodyPart.Charset = "iso-2022-jp"
.HTMLBodyPart.Charset = "iso-2022-jp"
End If
.Send
End With

Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
Set IBodyPart = Nothing
SendCDO = true
End Function
 
I found a or the "fix." Instead of setting .HTMLBodyPart.Charset =
"iso-2022-jp", I set

..TextBodyPart.Charset = "iso-2022-jp". This works. I presume because setting
the .AutoGenerateTextBody = True will create the HTMLMessage from the
TextMessage encoding.

Now, how do I set the .subject to encode/display in Japanese????

- Avram Grossman
 
Don't expect Outlook2000 to display a Japanese subject line. There is
a bug that prevents it from display correctly though I can't reference
a particular artical explaining it. Were you able to find any
resources on sending Japanese email correctly.
 
Back
Top