settings.asp
来自「一个虚拟主机代理系统」· ASP 代码 · 共 130 行
ASP
130 行
<%'=========================================
'ScriptMate User Manager Version 2.1
'Copyright 2001 (C) ScriptMate.Com
'Admin Module
'This module helps in testing an email component to be installed
'For any help with modification to
'this file contact support@scriptmate.com
'=========================================%>
<script language="JAVASCRIPT">
var errfound = false;
function ValidLength(item, len) {
return (item.length >= len);
}
function ValidEmail(item) {
if (!ValidLength(item, 5)) return false;
if (item.indexOf ('@', 0) == -1) return false;
if (item.indexOf ('.', 0) == -1) return false;
return true;
}
function error(elem, text) {
if (errfound) return;
window.alert(text);
elem.select();
elem.focus();
elem.style.backgroundColor=errorcolor;
errfound = true;
}
function Validate() {
errfound = false;
d=document.settings
if (!ValidLength(d.smummailserver.value,2))error(d.smummailserver,"Mail server Address should not be blank.");
if (!ValidLength(d.fromname.value,2))error(d.fromname,"Sender's Name should not be blank.");
if (!ValidEmail(d.fromaddress.value))error(d.fromaddress,"Please enter a valid email address ex. test@example.com");
if (!ValidLength(d.toname.value,2))error(d.toname,"To Name should not be blank.");
if (!ValidEmail(d.toaddress.value))error(d.toaddress,"Please enter a valid email address ex. test@example.com");
if (!ValidLength(d.subject.value,2))error(d.subject,"Subject should not be blank.");
if (!ValidLength(d.content.value,2))error(d.content,"Message should not be blank.");
return !errfound;
}
</script>
<%Sub Settings()
dim component,smummailserver,fromaddress,fromname,toaddress,toname,subject,content,result,todo
smumadminheader("Email Settings")
session("emailsettings")= ""
if not Application("smumdebugmode") then on error resume next
if session("admin") = "" then Response.Redirect smumadminpage & "?action=login"
todo = request("todo")
if todo = "" then
smumFormOpenTable
smumFormHeader "Email Components Test"%>
<tr class=colorformfields>
<td><font class=textsize9><%call smmailsettings()%></font></td>
</tr>
<%smumFormCloseTable
smumFormAction "<form action="""&smumadminpage&"?action=settings"" method=post name=settings language=""JAVASCRIPT"" onsubmit=""return Validate();"">"
smumFormHiddenField "todo","send"
smumFormOpenTable
smumFormHeader "Send a Test Email"%>
<tr class=colorformfields>
<td align=right><font class=textsize9>Email Component to Test</font></td>
<td><font class=textsize9>
<%if session("emailsettings") = "" then
Response.Write "No required components installed."
else%>
<select name=component><%=session("emailsettings")%></select>
<%end if%>
</font></td>
</tr>
<%smumFormFields "Mail Server Address","<input class=fieldbox type=text size=30 name=smummailserver>"
smumFormFields "Sender's Name","<input class=fieldbox type=text size=30 name=fromname>"
smumFormFields "Sender's Email Address","<input class=fieldbox type=text size=30 name=fromaddress>"
smumFormFields "To Name","<input class=fieldbox type=text size=30 name=toname>"
smumFormFields "To Email Address","<input class=fieldbox type=text size=30 name=toaddress>"
smumFormFields "Subject","<input class=fieldbox type=text size=30 name=subject>"
smumFormFields "Message","<textarea class=fieldbox cols=30 rows=7 name=content></textarea>"
smumFormButtons "<input class=fieldbox type=submit value=""Test Email Settings"" name=submit>"
smumFormCloseTable
smumFormClose
else
component = request("component")
smummailserver = request("smummailserver")
fromaddress = request("fromaddress")
fromname = request("fromname")
toname = request("toname")
toaddress = request("toaddress")
subject = request("subject")
content = request("content")
RESULT = sendmail(fromaddress, toaddress, fromname, toname, smummailserver, subject, content, component)
if result = "sent" then
smumFormOpenTable
smumFormHeader "Send a Test Email"
smumFormResponse "The Email was sent successfully."
smumFormCloseTable
else
smumFormOpenTable
smumFormHeader "Send a Test Email"
smumFormResponse "The following error occured when sending the email.<br> "&result
smumFormCloseTable
end if
end if
End Sub%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?