Link to home
Start Free TrialLog in
Avatar of ClOuD_Za
ClOuD_Za

asked on

ASP .. CDO.Message .. Charset (or Encoding)

Hi, Experts

I have a code which to send an e-mail out. Now I want it to send some other language than only English (ex, my local language, Thai). I tried every solution I could find in google but not work for me.

this is my code.

<%
Set CDONTS = Server.CreateObject("CDO.Message")

CDONTS.From = "............."(some e-mail)
CDONTS.To = "...................."(my e-mail)
CDONTS.Subject = "Customer Comment Sent At "&Now
CDONTS.HtmlBody = "<font color=blue size=5><b><u>Received Customer Comment</b></u></font><br><br>"
CDONTS.HtmlBody = CDONTS.HtmlBody & "Customer Name : <font color=red>"&Request.Form("NAME")&"</font><br>"&_
"Customer E-Mail : <font color=red>"&Request.Form("EMAIL")&"</font><br>"&_
"Customer Phone Number : <font color=red>"&Request.Form("PHONE")&"</font><br>"&_
"Received At : <font color=red>"&Now&"</font><br>"&_
"Customer Comment : <font color=red>"&Request.Form("COMMENT")&"</font><br>"&_
"<br>----------------------------------------------------------------------------------------------------------<br>"
%>

<%
CDONTS.Send
%>

this code is working fine with sending e-mail out but the language is incorrect...

please help
Avatar of B_Dorsey
B_Dorsey

you want windows to convert it from english to thai? or you just want the corret character set?
Avatar of ClOuD_Za

ASKER

I think the character is incorrect at the sending time. so windows couldn't deal with this.
i think it should be about setting e-mail's charset to TIS-620 (for Thai language).

with that microsoft kb. is that only about Date, Time and Currency ? because I don't need any of these in my e-mail body.
sorry for my poor english anyway :(
Try

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1054"%>
the browser said "the page cannot be display"

Error Type:
Active Server Pages, ASP 0203 (0x80004005)
The specified code page attribute is invalid.

with this line:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1054"%>

I insert that line at the first row of all.
You will also need to specify it in the HTML message also you are sending
you mean it must be inserted in the HTMLBody ?
ASKER CERTIFIED SOLUTION
Avatar of B_Dorsey
B_Dorsey

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It replace

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1054"%>

with

<%@codepage=65001%>

it shows no error but no e-mail has been sent.
first section of code ...

<%@codepage=65001%>
<%
Set CDONTS = Server.CreateObject("CDO.Message")
.
.
.
.
I think after a little research , the ASP must be set and also the html in the message must be set, so you have to include <html> and <head>,<body> tags...

in the ASP you need to:

response.Charset="windows-874"
or
<%@codepage=874%>

in the html you need

<meta http-equiv="Content-Type" content="text/html; charset=windows-874">

in your head tags
the ASP file is only to send out and e-mail . It has nothing to display on screen .

so still I need this line ?

response.Charset="windows-874"
I believe so cause your accepting text from a textbox? or is the text provided by you?
it's a set of value which is passed from a form via POST method.
Now the code is ..

<%@codepage=874%>
<%
Set CDONTS = Server.CreateObject("CDO.Message")

CDONTS.From = "......"
CDONTS.To = ".........."
CDONTS.Subject = "Customer Comment Sent At "&Now
CDONTS.HtmlBody = "<html><head>"
CDONTS.HtmlBody = CDONTS.HtmlBody & "<meta http-equiv=""Content-Type"" content=""text/html; charset=windows-874""></head><body>"
CDONTS.HtmlBody = CDONTS.HtmlBody & "<font color=blue size=5><b><u>Received Customer Comment</b></u></font><br><br>"
CDONTS.HtmlBody = CDONTS.HtmlBody & "Customer Name : <font color=red>"&Request.Form("NAME")&"</font><br>"&_
"Customer E-Mail : <font color=red>"&Request.Form("EMAIL")&"</font><br>"&_
"Customer Phone Number : <font color=red>"&Request.Form("PHONE")&"</font><br>"&_
"Received At : <font color=red>"&Now&"</font><br>"&_
"Customer Comment : <font color=red>"&Request.Form("COMMENT")&"</font><br>"&_
"<br>----------------------------------------------------------------------------------------------------------<br>"&_
"body></html>"
%>

<%
CDONTS.Send
%>

Nothing was sent ....

I also tested the code with <%@codepage=65001%> at the first row . nothing was sent also
no error?
yes, no error.
try jsut putting it in the HTML and removing the codepage
OK now ..

<%@codepage=65001%> works !!

it was an error at the ".........."

sorry 'bout that

thanks anyway and I raised the point to 250.

Thanks very much