Code Demo ->
http://www.ccopus.com/code/sample/smtpmail.asp
* 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
<%
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 in the form of a URL, which is invisible in the list of attachments, can be accessed in the body
Omail.attachurl Server.mappath ("ha.jpg"), "ha.jpg"
'// Add attachments in the form of file, visible in the list of attachments, can not be accessed directly in Question
Omail.attachfile Server.mappath ("mail.asp"), "smtpmail.txt"
'// Specify the base address of the MAIL body, you can't use AttachURL, otherwise the attachment file name attached to AttachURL will be incorrect.
'Omail.ContentBase = SCONTENTBASE
'// Specify the email topic
Omail.subject = SSUBJECT
'// Specify sender
Omail.from = sfrom
'// Specify the recipient, write multiple recipients, separated by commas
Omail.to = STO '// Copy to others, you can specify multiple, separated by commas
Omail.cc = SCC
'// Copy other people, you can specify multiple, separated by commas
OMAIL.BCC = SBCC
'// Specify the text
Omail.body = SBODY
'// Specify an email to 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 the message level 0: Ordinary 1: Confident 2: Top Secret
Omail.Importance = 0
'//send email
Omail.send
Set Omail = Nothing
%>