uncode for CDOSYS

X

xfile

Hi:

I am tring to send form result with CDOSYS, but I can't get it sent with
unicode message for objMail.HTMLBody

Can someone please help as I've tried many many suggestions from the net
including include a Code.Page as shown and also set the page properties to
Unicode (both the form page and this confirmation page both are ASP) but
none has worked

If someone entered a foreign words into the field, the email will turned to
"???"

Thanks so much.




----------------------



<% @Language="VBScript" @CodePage="65001" %>
<html>
<head>
<%

'Declare variables
Dim sMsg
Dim sTo
Dim sFrom
Dim sBCC
Dim sSubject
Dim sTextBody
Dim sHTMLBody
Dim sUserName
Dim sEmail
Dim varUserName
Dim varFirstName
Dim VarPassword
Dim varInfo_Shalom
Dim varInfo_Partner

'Get data from form page
sTo = Request.Form("UserName")
sFrom = "someone"
sBCC = "someone"
varUserName = Request.Form("UserName")
varFirstName = Request.Form("FirstName")
varPassword = Request.Form("Password")
varInfo_Shalom = Request.Form("Info_Shalom")
varInfo_Partner = Request.Form("Info_Partner")

'Only run this if it's not the first time
If Request.Form("Submit") <> "" Then

Dim objMail
'Create the mail object
Set objMail = Server.CreateObject("CDO.Message")

'Set key properties
objMail.From = sFrom
objMail.To = sTo
objMail.BCC = sBCC
objMail.Subject = "Test Result"
objMail.HTMLBody = "" & "<br />"_
& "Dear " & VBCrLf & varFirstName & ":" & "<br />"_
& "" & "<br />"_
& "Hello." & "<br />"_
& "" & "<br />"_
& "The following is test result: " & "<br />"_
& "" & "<br />"_
& "Your user name is: " & VBCrLf & varUserName & "<br />"_
& "Your password is: " & VBCrLf & varPassword & "<br />"_
& "Thank you" & "<br />"_


'Send the email
objMail.Send

'Clean-up
Set objMail = Nothing

End If

%>
 
D

David Berry

This is actually CDONTS code, not CDOSYS but you can do it this way as well.
What you need to do is add 2 additional parameters to your New Mail object
before you do the "send". They are:

objMail.MailFormat = 0
objMail.SetLocaleIDs(65001)

The first sets the mime format to use and the second sets Unicode as the
locale. You may not need the MailFormat line (try it first without it)
since you're trying to send HTML. I can't remember if that's for Text only
or not.

You can get rid of the @CodePage= line.
 
X

xfile

Hi:

Thanks for the help, and this is what happened:

(1) I tried the two lines several times together and separately, but all
failed. I got an error message for object and/or method is not supported.

Finally, I did a lot of searches again, and back to MS using "CDO and
Unicode" and found one article titled: Specifying the Header Fields
Character Set (CDO for Windows 2000)

At the very bottom of the article (for VBscript), there is a line:
..BodyPart.Charset = "iso-2022-jp"

I changed it to: objMail.BodyPart.Charset = "utf-8"

Viola, I got the Unicode :)

Hope this helps others also.

Thanks again for the kind help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Help with CDO 6
cdo nearly there I think 3

Top