window| Email | Registration component In fact, ASP can do a lot of things, but we do not know how to use. 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? To send a message under Winnt and Win2K to use the Cdonts.newmail,cdonts.newmail component is required to register, very simple, just run the command line on the server regsvr32 Cdonts.dll, OK in the pop-up dialog box, use the Cdonts.newmail service also need to install IIS from the SMTP. 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.
<%
Dim cm
Set cm=server.createobject ("CDO.") Message ")
' Create object
Cm. From= "From@test.com"
' Set the sender's mailbox
Cm. To= "To@test.com"
' 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= "http://www.knowsky.com/rss/"
' Above is the use of ordinary text format to send mail, only text, can not support HTML, so there is no
Cm. htmlbody= "Online RSS Feeds Reader is an on-line RSS news reading system." "&_
"No need to download the installation, as long as you register you can have as powerful as the software RSS online subscription aggregation news system." "&_
"No matter where you are, as long as you can surf the Internet, you can read your favorite subscriptions." "&_
"Sign up now: <a href=http://www.gbmad.net/rss/>http://www.gbmad.net/rss/</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. AddAttachment Server.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
Set cm=nothing
' Instant release of the object after successful delivery
Response.Write ("The message was sent successfully.) ")
%>