ASP数据库连接方式大全(15)
exitcode = oShell.Run("c:\WINNT\system32\regsvr32.exe /u/s " & strFile, 0, False)
EchoB("regsvr32.exe exitcode = " & exitcode)
End IF
Cleanup oShell
End Sub
Sub BuildOptions
EchoB("Register: <INPUT TYPE=RADIO NAME=frmMethod value=REG CHECKED>")
EchoB("unRegister: <INPUT TYPE=RADIO NAME=frmMethod value=UNREG>")
End Sub
Function Echo(str)
Echo = Response.Write(str & vbCrLf)
End Function
Function EchoB(str)
EchoB = Response.Write(str & "<BR>" & vbCrLf)
End Function
Sub Cleanup(obj)
If isObject(obj) Then
Set obj = Nothing
End IF
End Sub
Sub Class_Terminate()
Cleanup oFS
End Sub
End Class
%>
利用CDONTS发送邮件的ASP函数
<%
'Last Updated By Recon On 05/14/2001
'On Error Resume Next
'利用CDONTS组件在Win2k上发送邮件
'发送普通邮件
SendMail "admin@ny.com", "iamchn@263.net", "Normal Mail!", "Please check the attatchment!", 2, 0, "C:\Love.txt"
'发送HTML邮件
Dim m_fso, m_tf
Dim m_strHTML
Set m_fso = Server.CreateObject("SCRIPTING.FILESYSTEMOBJECT")
Set m_tf = m_fso.OpenTextFile("C:\Mail.htm", 1)
m_strHTML = m_tf.ReadAll
'Write m_strHTML
Set m_tf = Nothing
Set m_fso = Nothing
SendMail "admin@ny.com", "iamchn@263.net", "HTML Mail!", m_strHTML, 2, 1, Null
'参数说明
'strFrom : 发件人Email
'strTo : 收件人Email
'strSubject : 信件主题
'strBody : 信件正文
'lngImportance : 信件重要性
' : 0 - 低重要性
' : 0 - 中等重要性(默认)
' : 0 - 高重要性
'lngAType : 信件格式
' : 为1时将邮件正文作为HTML(此时可以发送HTML邮件)
'strAttach : 附件的路径
Sub SendMail(strFrom, strTo, strSubject, strBody, lngImportance, lngAType, strAttach)
Dim objMail
Set objMail = Server.CreateObject("CDONTS.NEWMAIL")
With objMail
.From = strFrom
.To = strTo
.Subject = strSubject
.Body = strBody
.Importance = lngImportance
If lngAType = 1 Then
.BodyFormat = 0
.MailFormat = 0
End If
If IsEmpty(strAttach) = False And IsNull(strAttach) = False Then
内容版权声明:除非注明,否则皆为本站原创文章。