470,619 Members | 1,829 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,619 developers. It's quick & easy.

cdonts question

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~
Jul 19 '05 #1
5 4280
"Vitamin" <ha*@seeWhat.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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.

Jul 19 '05 #2
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~
"Egbert Nierop (MVP for IIS)" <eg***********@nospam.com> wrote in message
news:uA**************@tk2msftngp13.phx.gbl...
"Vitamin" <ha*@seeWhat.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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.

Jul 19 '05 #3
"Vitamin" <ha*@seeWhat.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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();

Also, do you have any sample code for my reference?

thx~
"Egbert Nierop (MVP for IIS)" <eg***********@nospam.com> wrote in message
news:uA**************@tk2msftngp13.phx.gbl...
"Vitamin" <ha*@seeWhat.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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.



Jul 19 '05 #4
> 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

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #5
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~

"Egbert Nierop (MVP for IIS)" <eg***********@nospam.com> wrote in message
news:OD**************@TK2MSFTNGP12.phx.gbl...
"Vitamin" <ha*@seeWhat.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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();

Also, do you have any sample code for my reference?

thx~
"Egbert Nierop (MVP for IIS)" <eg***********@nospam.com> wrote in message
news:uA**************@tk2msftngp13.phx.gbl...
"Vitamin" <ha*@seeWhat.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
> 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.


Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Steve | last post: by
12 posts views Thread by Jeff | last post: by
4 posts views Thread by Dr. Harvey Waxman | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.