how can I write an ASP program to send email?

how can I write an ASP program to send email with the MS SMTP service?

There are some sample like this :

 dim oMsg

    Set oMsg = server.createobject("CDONTS.NewMail")
       oMsg.To =
       oMsg.From =
       oMsg.Subject = "this is the subject line"
       oMsg.Body = "sail away..."


Can you tell me more about this object?
Such as how to attach file to email, how to control the encoding of attachment?

   set oMsg = nothing
Who is Participating?
MasseyMConnect With a Mentor Commented:
Check out these articles:

When you go to these articles, be sure to click the "Sync TOC" image at the top left.
KNVB HKSITOAuthor Commented:
The content is very useful for me.
However, how can I send Chinese/Double Byte Character Set  email?
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

KNVB HKSITOAuthor Commented:
I have tried it.
Also, I have installed the code on the NT server.
But it still doesn't work.

Does you have Exchange installed on the server?  You must have that installed to use the CDONTS system...

If not, I reocmmned you use JMail from  It is free and VERY good.
KNVB HKSITOAuthor Commented:
First, I should thank you for your suggestion. However, if the mail subject is chinese, then MS outlook client can't read the chinese subject.

By the way, I have another problem on it. I have installed IIS 4.0 on other  server. However, the SMTP server cannot send email using the previous .asp program, but it can received email from outside.

The original server is PDC. And the new server is just a stand alone server.  I think this is the only difference between them.
So, do you know what happening?

i think cdonts only need smtp,isn't it?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.