* Note, Windows XP, Windows 2003 is not included with cdonts.dll by default, you must be installed manually, you can get the file from the Windows 2000 System32, if not, you can download (download CDOV1.2 cdonts.dll 394KB), Installation method: Step1: Copy the file to% systemroot% / system32; step2: Start -> Run -> regsvr32 cdonts.dll; step3: confirm
Code analysis
Source Code
<%
Dim Omail, Sbody, SCC, SBCC, STO, SFROM, SSUBJECT, SCONTENTBASE
'// Construct the text
SBODY = "" & _
"
" & _"
"
Welcome tour Cocoon Studio.
"& _
"& _
"This picture comes from attachment specified by AttachURL " & _
Body> "& _
Head> "& _
" Html>"
SSUBJECT = "Send Mail with CDONTS"
sfrom = "sunrise@citiz.net"
STO = "sunrise_chen@citiz.net"
SCC = "sunrise@jin.com"
SBCC = "sunrise@citiz.net"
ScontentBase = "http://www.ccopus.com/"
Set Omail = Server.createObject ("cdonts.newmail")
'// Add an attachment as a URL, which is invisible in the list of attachments, you can access Omail.attachURL Server.Mappath ("ha.jpg"), "ha.jpg"), "ha.jpg"), "ha.jpg"), "ha.jpg"' //, in the file In the list of attachments, it is not possible to directly access OMAIL.ATCHFILE Server.mappath ("mail.asp"), "SMTPMAIL.TXT" '//, cannot be used at the same time at AttachURL, otherwise, AttachURL The attached attachment file name is incorrect. 'OMAIL.CONTENTBASE = SCONTENTBASE' // Specify mail theme omail.subject = SSUBJECT '// Specify sender Omail.From = SFROM' // Specify recipient, write multiple recipients, separated from Omail with comma .To = STO '// Copy to others, you can specify multiple, separated from Omail.cc = scc' // with commas, you can specify multiple, with a comma, Omail.bcc = SBCC '// Specify mail body OMAIL.BODY = SBODY' // Specify mail for html format '// 0: The newmail object is to be in mime format.' // 1: The newmail object is to be in uninterrupted plain text Default value) .omail.mailformat = 0 '// Specify the message to Mine format' // 0: The body property is to include Hypertext Markup Language (HTML). '// 1: The Body Property Is To Be Exclusively in Plain Text (default value) .omail.bodyformat = 0 '// Specify mail level 0: Ordinary 1: Confident 2: Top Secret Omail.Importance = 0' // Send Mail Omail.send
Set Omail = NOTHING%>