Microsoft KB Archive/264072

= How To Send E-mail in Different Languages by Using CDONTS from Active Server Pages =

Article ID: 264072

Article Last Modified on 8/30/2004

-

APPLIES TO


 * Microsoft Collaboration Data Objects 1.2 for NT Server

-



This article was previously published under Q264072



SUMMARY
This article demonstrates how to send localized e-mail messages from an Active Server Pages (ASP) page by using Collaboration Data Objects for NTS (CDONTS).



MORE INFORMATION
The sample code in this article requires that you have the proper codepages installed on the Internet Information Server (IIS) server, and that you have a way to enter the characters properly in the ASP page's input box. The code uses CDONTS to send a localized SMTP-formatted message. It sets the CHARSET of the ASP page to the localized language. To make sure that the double-byte character set (DBCS) data is generated properly, you will need an Input Method Editor (IME). For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

211147 Internet Explorer Script Prompts and MBCS/Unicode

  

  CDONTSMail <% @CODEPAGE=932%> <%   if not IsEmpty(Request.Form(&quot;text1&quot;)) then

nCodePage = 932        ' Japanese code page

sFrom = &quot;&quot; sTo = &quot;&quot; sSubj = &quot;This is a test on : &quot; & now Set objMail = server.CreateObject(&quot;CDONTS.Newmail&quot;)

'MSG Text. objMail.SetLocaleIDs(nCodePage)

' Set the message properties. objMail.From = sFrom objMail.To = sTo objMail.Subject = sSubj objMail.Body = Request.Form(&quot;text1&quot;) ' Set the message Format. objMail.MailFormat = 0 'MIME objMail.BodyFormat = 1 '0 HTML / 1 Text

' Send the message. objMail.Send Set objMail = Nothing 'Output the information. 'Response.Write Request.Form(&quot;text1&quot;) & &quot; &quot; sout = Request.Form(&quot;text1&quot;) Response.Write &quot;sout: &quot; & sout end if %>

 Enter the localized message body text below: &#xa0;</P> <FORM action=&quot;&quot; id=FORM1 method=post name=FORM1> <INPUT id=text1 name=text1> <INPUT id=submit1 name=submit1 type=submit value=Submit> </FORM> &#xa0;</P> Note: The the 'From' and 'To' addresses are hard-coded into the ASP page.</P> </BODY> </HTML> NOTE: If you are using Microsoft Windows 2000 or later, it is recommended that you use CDO for Windows 2000 (CDOSYS) instead of CDONTS. If you are using Microsoft Windows XP or later, CDONTS is not available; CDO for Windows 2000 is recommended for use with Windows XP.

Keywords: kbhowto KB264072

-

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

© Microsoft Corporation. All rights reserved.