Microsoft KB Archive/284143

= How To Send Japanese Characters by Using CDO for Windows 2000 =

Article ID: 284143

Article Last Modified on 2/22/2007

-

APPLIES TO


 * Microsoft Windows 2000 Service Pack 1
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Service Pack 1
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Exchange 2000 Server Standard Edition

-



This article was previously published under Q284143



SUMMARY
The following example demonstrates the code that is required to send Japanese double-byte character-set, using Collaboration Data Objects (CDO) for Windows 2000.

NOTE: You must have the input locale for Japanese set up on your computer.



MORE INFORMATION
 Create a new project in Visual Basic. Set up the form as follows:

Object---Name



Form -- FrmTest

Command Button -- cmdSend

Command Button -- cmdQuit

TextBox --- txtPort (Value: 25)

TextBox --- txtServer

TextBox --- txtTo

TextBox --- txtFrom

TextBox --- txtSubject

TextBox (Forms 2.0) txtBody

 Add a reference to the CDO for Windows 2000 object library.  Add the following code to the form: Private Sub cmdQuit_Click Unload Me End Sub

Private Sub cmdSend_Click On Error GoTo errhand

Dim objConfig As CDO.Configuration Dim objMessage As CDO.Message Set objConfig = New CDO.Configuration

' Set the configuration fields for this message. With objConfig.Fields .Item(cdoSendUsingMethod) = cdoSendUsingPort .Item(cdoSMTPServer) = txtServer ' Set the SMTP server .Item(cdoSMTPConnectionTimeout) = 30 .Item(cdoSMTPServerPort) = txtPort ' Set the port to communicate on       .Item(cdoSendUserName) = &quot;user1&quot; .Item(cdoSendPassword) = &quot;user1&quot; .Update End With

' Create the new message object. Set objMessage = New CDO.Message ' Set the message properties and send the message. With objMessage Set .Configuration = objConfig .MimeFormatted = True .Fields.Update .To = &quot;<&quot; & txtTo & &quot;>&quot; .From = &quot;<&quot; & txtFrom & &quot;>&quot; .Subject = txtSubject .TextBody = txtBody ' Set the Character set for the Body Part. .TextBodyPart.Charset = cdoShift_JIS ' Get the plain text version of the message & decoded body part. Set IBodyPart = objMessage.TextBodyPart IBodyPart.GetDecodedContentStream .Send End With

Set objMessage = Nothing Set mobjConfig = Nothing

Exit Sub

errhand:

MsgBox &quot;Error: &quot; & Err.Number & &quot; (&quot; & Err.Description & &quot;) occurred&quot;

Set objMessage = Nothing Set objConfig = Nothing

End Sub

.

 Run the project. Type the name of your SMTP server in the txtServer field, and fill in the txtTo, txtFrom, and txtSubject fields. Paste the Japanese text into the txtBody field, or enter it with the Windows Input Method Editor (IME).</li> Click cmdSend.</li></ol>

Additional query words: localized CDOSYS mailer SMTP

Keywords: kbhowto KB284143

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.