文章編號: 284143 - 上次校閱: 2007年2月22日 - 版次: 3.4

如何使用 Windows 2000 CDO 傳送日文字元

系統提示本文適用於您使用的作業系統之外的作業系統。與您不相關的文章內容已停用。
全部展開 | 全部摺疊

結論

在下列範例中,示範了所需傳送日文雙位元組字元集,針對 Windows 2000 使用共同作業資料物件 (CDO) 的程式碼。

注意: 日文設定您的電腦上必須有輸入法地區設定。

其他相關資訊

  1. 在 Visual Basic 中建立新專案。設定表單如下:
    物件-------------------名稱
    *************************
    表單------------------FrmTest
    指令按鈕------cmdSend
    指令按鈕------cmdQuit
    TextBox---------------txtPort (值: 25)
    TextBox---------------txtServer
    TextBox---------------txtTo
    TextBox---------------txtFrom
    TextBox---------------txtSubject
    TextBox (Form 2.0)----txtBody

  2. 加入 Windows 2000 CDO 物件程式庫的參考。
  3. 將下列程式碼加入至表單:
    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) = "user1" 
            .Item(cdoSendPassword) = "user1"
            .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 = "<" & txtTo & ">"
            .From = "<" & txtFrom & ">"
            .Subject = txtSubject
            .TextBody = txtBody<BR/>
           
            ' 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 "Error: " & Err.Number & " (" & Err.Description & ") occurred"
    
    Set objMessage = Nothing
    Set objConfig = Nothing
    
    End Sub
    
    					

  4. 執行專案。
  5. txtServer] 欄位中輸入 SMTP 伺服器的名稱,然後填寫 txtTotxtFromtxtSubject 欄位。
  6. 日文文字貼入 [txtBody] 欄位,或輸入它與 Windows 輸入法編輯器 (IME)。
  7. 按一下 cmdSend

這篇文章中的資訊適用於:
  • Microsoft Windows 2000 Server SP1
  • Microsoft Windows 2000 Advanced Server SP1
  • Microsoft Windows 2000 Professional SP1
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Exchange 2000 Server Standard Edition
關鍵字:?
kbmt kbhowto KB284143 KbMtzh
機器翻譯機器翻譯
重要:本文是以 Microsoft 機器翻譯軟體翻譯而成,而非使用人工翻譯而成。Microsoft 同時提供使用者人工翻譯及機器翻譯兩個版本的文章,讓使用者可以依其使用語言使用知識庫中的所有文章。但是,機器翻譯的文章可能不盡完美。這些文章中也可能出現拼字、語意或文法上的錯誤,就像外國人在使用本國語言時可能發生的錯誤。Microsoft 不為內容的翻譯錯誤或客戶對該內容的使用所產生的任何錯誤或損害負責。Microsoft也同時將不斷地就機器翻譯軟體進行更新。
按一下這裡查看此文章的英文版本:284143? (http://support.microsoft.com/kb/284143/en-us/ )
Microsoft及(或)其供應商不就任何在本伺服器上發表的文字資料及其相關圖表資訊的恰當性作任何承諾。所有文字資料及其相關圖表均以「現狀」供應,不負任何擔保責任。Microsoft及(或)其供應商謹此聲明,不負任何對與此資訊有關之擔保責任,包括關於適售性、適用於某一特定用途、權利或不侵權的明示或默示擔保責任。Microsoft及(或)其供應商無論如何不對因或與使用本伺服器上資訊或與資訊的實行有關而引起的契約、過失或其他侵權行為之訴訟中的特別的、間接的、衍生性的損害或任何因使用而喪失所導致的之損害、資料或利潤負任何責任。