⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendemail.asp

📁 一个虚拟主机代理系统
💻 ASP
字号:
<%'=========================================
'ScriptMate User Manager Version 2.1
'Copyright 2001 (C) ScriptMate.Com
'Admin Module
'This module helps in sending emails
'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.sendemail
		   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.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 Sendemail()

	dim todo,fromaddress,fromname,toaddress,toname,subject,content,result,id,members_username,members_email
	
	smumadminheader("Send a Email")

	if not Application("smumdebugmode") then on error resume next
	
	if session("admin") = "" then Response.Redirect smumadminpage & "?action=login"
	
	todo = request("todo")
	
	if todo = "" then

		id = request("id")

		smumquery = "select members_username,members_email from smum_memberstbl where members_id= "&id
		smumOpenrs smumquery,"smumrs",action
	
			if not smumrs.eof then
				members_username = smumrs("members_username")
				members_email = smumrs("members_email")
			end if	
			
		smumClosers(smumrs)
	
		smumFormAction "<form action="""&smumadminpage&"?action=sendemail"" method=post name=sendemail language=""JAVASCRIPT"" onsubmit=""return Validate();"">"
		smumFormHiddenField "todo","send"
		smumFormOpenTable
		smumFormHeader "Send a Email"
		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 value="""&members_username&""">"
		smumFormFields "To Email Address","<input class=fieldbox type=text size=30 name=toaddress value="""&members_email&""">"
		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=""Send Email"" name=submit>"
		smumFormCloseTable
		smumFormClose		
	
	else

		fromaddress = request("fromaddress")
		fromname = request("fromname")
		toname = request("toname")
		toaddress = request("toaddress")
		subject = request("subject")
		content = request("content")
		
		result = sendmail(fromaddress, toaddress, fromname, toname, Application("smummailserver"), subject, content, Application("smummailcomponent"))		
		
		if result = "sent" then
		
			smumFormOpenTable
			smumFormHeader "Send a Email"
			smumFormResponse "The Email was sent successfully."
			smumFormCloseTable
		
		else
		
			smumFormOpenTable
			smumFormHeader "Send a 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -