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")
.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
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"0 Then
.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