window| Email | Register component
In fact, the ASP can do a lot of things, but we do not know how to use and. Microsoft provides ASP with a lot of out-of-the-box useful components that no one knows about, such as sending mail with Cdo.message.
What is Cdo.message? Send mail under Winnt and Win2K to use the Cdonts.newmail,cdonts.newmail component is required to register, very simple, as long as the Server Run command line Regsvr32Cdonts.dll, in the pop-up dialog box to determine, use the Cdonts.newmail The service also needs to have IIS with its own SMTP installed. To the windows2003, the system is not accompanied by Cdonts.dll files, only a similar file Cdosys.dll, of course, this file in Win2K is also some (need to register components), but 2003 what is the good? The component does not need to be registered manually, and the system is automatically registered. Now let's take a look at how to use the component.
<%
Dimcm
Setcm=server.createobject ("CDO.") Message ")
' Create object
Cm. From= ""
' Set the sender's mailbox
Cm. To= ""
' Set up a recipient's mailbox
Cm. subject= "I found a website that can subscribe to RSS feeds online, and I don't have to install any more software." "
' Set the subject of the message
' cm. Textbody= "Welcome to Xiaoyu Online"
' Above is the use of ordinary text format to send mail, only text, can not support HTML, so there is no
Cm. Htmlbody= "Look at the network world, show a hero" &_
"Join the Rain Online website Alliance now!" "&_
"Go sign up,:<ahref=http://www.smallrain.net/webmeng.asp> website Alliance </a>"
' Above is the HTML body you built, so the message is much better than just text. Don't say you can't do HTML.
' cm. Addattachmentserver.mappath ("Test.zip")
' If you need to send an attachment, use the above method to attach the file.
Cm. Send
' The last of course was to execute the sent
Setcm=nothing
' Instant release of the object after successful delivery
Response.Write ("The message was sent successfully.) ")
%>