cdonts question

V

Vitamin

I need send an email to my client by using CDONTS, which contain a utf-8
characters

then i am using following code

mailObject.value("Content-type") = "text/plain; charset=utf-8"
mailObject.value ("Content-transfer-encoding") = "8bit"

ls_body = ls_body & "<html><head>"
ls_body = ls_body & "<META HTTP-EQUIV=""Content-Type"" CONTENT=""text/html;
charset=utf-8""></head><body >"
ls_body = ls_body & "<font size=2>An Exhibitor has submitted a form to you
through our on-line manual system:</br></br>" & chr(13) & chr(13)
ls_body = ls_body & "Form : " & form_name & "(Form " & form_number & ")"&
"</br>" & chr(13) & chr(13)
ls_body = ls_body & "</body></html>"

mailObject.Body = ls_body
mailObject.send
set mailObject= nothing

but it sees no work...what's wrong??

thx~
 
A

Aaron Bertrand [MVP]

but it sees no work...what's wrong??

Could you define "no work" a little better? Do you get an error message?
If so, what is it? Do you not get the e-mail? Does the e-mail go to the
wrong person? Does the text not appear right?

It's very difficult to offer you suggestions when all we have to go on is
"it's broke."

BTW, do you really need to declare UTF-8 just to send HTML content? And are
you sure you want to use CDONTS as opposed to CDO.Message?

See http://www.aspfaq.com/2474 and http://www.aspfaq.com/2026
 
E

Egbert Nierop \(MVP for IIS\)

Vitamin said:
ok, i am sorry that about it.
I am try to send a email, that include a words which would be encoded by
using both big5 and gb2312, so, I need using utf-8 to display both big5 and
gb2312 in the same email.
That's possible only, if the input can be done in unicode-2 format, the mail
would be encoded correctly then.
So,
First set the MIME-encoding to utf-8
Set the body text, and care for it that the Stream object for the body is
set to Utf-8 as well (w're talking about CDO here!).
Store the text (using a unicode-2 BSTR or string) and you're done.
 
V

Vitamin

does you mean using ADODB.Stream object to display the utf-8 char??
but I need display in the mail, since if I display the mail content in html
page, I can see it correctly.
Also, do you have any sample code for my reference?

thx~
 
E

Egbert Nierop \(MVP for IIS\)

Vitamin said:
does you mean using ADODB.Stream object to display the utf-8 char??
but I need display in the mail, since if I display the mail content in html
page, I can see it correctly.
To display the mail correctly, you'll have to write the mail first right? :)

Code below is not tested for your situation but it looks like the right
direction.

cdoMsg.BodyPart.ContentMediaType=
CDO.CdoContentTypeValues.cdoMultipartMixed;

//

//cdoMsg.BodyPart.ContentTransferEncoding = null;

CDO.IBodyPart pBP = cdoMsg.BodyPart.AddBodyPart(-1);

pBP.Charset = this.mEncoding.BodyName;

pBP.ContentMediaType = CDO.CdoContentTypeValues.cdoTextPlain;

pBP.ContentTransferEncoding = CDO.CdoEncodingType.cdoBase64;

str = pBP.GetDecodedContentStream(); // ADODB.Stream object

//StreamWriter does the unicode/encoding stuff

// we must not touch for now, the original data, *just* copy

str.Charset = "unicode";

str.WriteText(this.mBody, ADODB.StreamWriteEnum.adWriteChar);

str.Flush();

str.Close();
 
V

Vitamin

Hi Egbert,

I am sorry that distrub you again, I would like to know which language you
used in the sample coding?
I am using ASP, but...I cannot understand the coding, any reference about
the coding?

thx~
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top