📄 utilities.asp
字号:
<%'=========================================
'ScriptMate User Manager Version 2.1
'Copyright 2001 (C) ScriptMate.Com
'Utilities Module
' this module contains all the utilities used in the application
'For any help with modification to
'this file contact support@scriptmate.com
'=========================================
Function sendmail(fromadr, toadr, fromname, toname, mailserver, subject, body, component)
dim smummailquery, mail, todo
body = replace(body, "<br>", vbcrlf )
todo = request("todomail")
if application("smummessagequeuing") and session("smbulkmail") and todo = "" and session("smumstartsend") = "" then
if fromadr <> "" and toadr <> "" then
smummailquery = "insert into smum_messagequeuetbl (mesque_toname,mesque_toemail,mesque_fromname,mesque_fromemail,mesque_subject,mesque_message) values ('"&toname&"','"&toadr&"','"&fromname&"','"&fromadr&"','"&subject&"','"&body&"')"
smumexecutequery smummailquery,action
end if
sendmail = "sent"
else
Select Case component
'For ASPEmail Component
Case "ASPEMAIL"
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = mailserver
Mail.From = fromadr
Mail.FromName = fromname
Mail.AddAddress toadr, toname
Mail.Subject = subject
Mail.Body = body
Mail.Send
If Err <> 0 Then
sendmail = Err.Description
else
sendmail = "sent"
End If
Set mail = nothing
'For ASPMail Component
Case "ASPMAIL"
Set Mail = Server.CreateObject("SMTPsvg.Mailer")
Mail.FromName = fromname
Mail.FromAddress = fromadr
Mail.RemoteHost = mailserver
Mail.AddRecipient toname, toadr
Mail.Subject = subject
Mail.BodyText = body
if Mail.SendMail then
sendmail = "sent"
else
sendmail = Mail.Response
End If
Set mail = nothing
'For CDONTS Component
Case "CDONTS"
Set Mail = Server.CreateObject("CDONTS.NewMail")
Mail.To = toadr
Mail.From = fromadr
Mail.Subject = subject
Mail.Body = body
Mail.Send
if Err then
SendMail = "Error"
else
SendMail = "sent"
end if
Set Mail = nothing
'For JMAIL Component
Case "JMAIL"
Set Mail = Server.CreateOBject( "JMail.Message" )
Mail.Logging = true
Mail.silent = true
Mail.From = fromadr
Mail.FromName = fromname
Mail.AddRecipient toadr, toname
Mail.Subject = subject
Mail.Body = body
if not Mail.Send(Mailserver) then
sendMail = Mail.log
else
sendMail = "sent"
end if
Set Mail = nothing
'For OCXMAIL Component
Case "OCXMAIL"
Set Mail = Server.CreateObject("ASPMail.ASPMailCtrl.1")
recipient = toadr
sender = fromadr
subject = subject
message = body
Mailserver = Mailserver
result = Mail.SendMail(Mailserver, recipient, sender, subject, message)
If "" = result Then
sendMail = "sent"
Else
sendMail = result
End If
Set Mail = nothing
'For Simplemail Component
Case "SIMPLEMAIL"
Set Mail = Server.CreateObject("ADISCON.SimpleMail.1") ' create Mailer!
Mail.Mailserver = Mailserver
Mail.Sender = fromadr
Mail.Recipient = toadr
Mail.Subject = subject
Mail.MessageText = body
Mail.Send
if Mail.Send = 0 then
sendMail = "sent"
else
sendMail = Mail.laststatus
End If
Set Mail = Nothing
End Select
end if
End Function
Sub smmailsettings()
dim comptest
on error resume next
comptest = comptest & msg("persits.mailsender", "ASPEMAIL")
comptest = comptest & msg("SMTPsvg.mailer", "ASPMAIL")
comptest = comptest & msg("CDONTS.newmail", "CDONTS")
comptest = comptest & msg("jmail.SMTPMail", "JMAIL")
comptest = comptest & msg("ASPMail.ASPMailCtrl.1", "OCXMAIL")
comptest = comptest & msg("ADISCON.simplemail.1", "SIMPLEMAIL")
Response.Write comptest
End Sub
Function msg(component, name)
on error resume next
dim tempobject, whicherr
Set tempobject=server.createobject(component)
whicherr=err.number
If whicherr=0 then
msg = "<font size=2 face=tahoma, verdana, arial color=black> " & Name & " is Registered</font>, "
session("emailsettings") = session("emailsettings") & "<option value="&name&">"&name&"</option>"
else
If whicherr=-2147221005 then
msg = "<font size=2 face=tahoma, verdana, arial color=Red> " &Name & " is not registered</font>, "
else
msg = "<font size=2 face=tahoma, verdana, arial color=Blue> " & Name & " failed. Error #" & whicherr &" : "& err.description & "</font>, "
end if
end if
Set tempobject=nothing
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -