📄 sendmail.asp
字号:
<!--#include file="conn.asp"-->
<HTML><HEAD><TITLE>打包邮递</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<link rel="stylesheet" type="text/css" href="style.css">
<META content="Microsoft FrontPage 4.0" name=GENERATOR></HEAD>
<BODY bgcolor="#ffffff" alink="#333333" vlink="#333333" link="#333333" topmargin="10" leftmargin="10">
<%
dim rs,sql
dim boardtype
dim foundErr
dim ErrMsg
dim topic
dim mailbody
dim email
dim id
foundErr = false
ErrMsg = ""
Call getInput()
call chkInput()
set rs=server.createobject("adodb.recordset")
if foundErr then
call Error()
else
call showPage()
end if
sub showPage()
'on error resume next
if foundErr then
call Error()
else
if request("action")="sendmail" then
if IsValidEmail(trim(Request.Form("mail")))=false then
errmsg=errmsg+"<br>"+"<li>您的Email有错误!</li>"
founderr=true
else
email=trim(Request.Form("mail"))
end if
call announceinfo()
if founderr then
call Error()
else
call jmail(email)
call success()
end if
else
call pag()
end if
end if
if err.number<>0 then err.clear
end sub
sub announceinfo()
topic="您从OA系统发来的文件资料"
mailbody=mailbody &"<style>A:visited { TEXT-DECORATION: none }"
mailbody=mailbody &"A:active { TEXT-DECORATION: none }"
mailbody=mailbody &"A:hover { TEXT-DECORATION: underline overline }"
mailbody=mailbody &"A:link { text-decoration: none;}"
mailbody=mailbody &"A:visited { text-decoration: none;}"
mailbody=mailbody &"A:active { TEXT-DECORATION: none;}"
mailbody=mailbody &"A:hover { TEXT-DECORATION: underline overline}"
mailbody=mailbody &"BODY { FONT-FAMILY: 宋体; FONT-SIZE: 9pt;}"
mailbody=mailbody &"TD { FONT-FAMILY: 宋体; FONT-SIZE: 9pt }</style>"
Rs.open "Select title,content,dateandtime,writer from article where articleid="&id&"",conn,1,1
announce=announce &"<TABLE border=0 width='95%' align=center><TBODY><TR>"
announce=announce &"<TD valign=middle align=top>"
announce=announce &"-- 作者:"&rs("writer")&"<br>"
announce=announce &"-- 发布时间:"&rs("dateandtime")&"<br><br>"
announce=announce &"-- "&rs("title")&"<br>"
announce=announce &""&rs("content")&""
announce=announce &"<hr></TD></TR></TBODY></TABLE>"
rs.close
mailbody=mailbody+announce
mailbody=mailbody &"<center><a href=http://www.e169.net>OAsystem</a>"
' response.write mailbody
' mailbody=""
' response.end
end sub
sub pag()
%>
<table cellpadding=0 cellspacing=0 border=0 width=460 bgcolor=#777777 align=center>
<tr>
<td>
<table cellpadding=6 cellspacing=1 border=0 width=100%>
<form action="sendmail.asp?action=sendmail&id=<%=id%>" method=post>
<tr>
<td bgcolor=#EEEEEE valign=middle colspan=2 align=center>
<b>打包邮递</b></td></tr>
<tr>
<td bgcolor=#FFFFFF valign=middle colspan=2>
<b>把本文打包邮递。</b><br>请正确输入你要邮递的邮件地址!
</td></tr><tr>
<td bgcolor=#EEEEEE><b>邮递的 Email 地址:</b></td>
<td bgcolor=#EEEEEE><input type=text size=40 name="mail"></td>
</tr><tr>
<td colspan=2 bgcolor=#EEEEEE align=center><input type=submit value="发 送" name="Submit"></table></td></form></tr></table>
<%
end sub
Sub getInput()
'On Error Resume Next
Rem ------获取ID------
ID = Request("ID")
End Sub
sub chkInput
'on error resume next
if ID="" then
foundErr = true
ErrMsg=ErrMsg+"<br>"+"<li>请指定相关文章</li>"
end if
end sub
sub success()
%>
<table cellpadding=0 cellspacing=0 border=0 width=460 bgcolor=#777777 align=center>
<tr>
<td>
<table cellpadding=3 cellspacing=1 border=0 width=100%>
<tr align="center">
<td width="100%" bgcolor=#EEEEEE>成功:打包邮递</td>
</tr>
<tr>
<td width="100%" bgcolor=#FFFFFF>恭喜您,您的打包邮递发送成功。
</td>
</tr>
<tr align="center">
<td width="100%" bgcolor=#EEEEEE>
<a href="javascript:history.go(-1)"> << 返回上一页</a>
</td>
</tr>
</table> </td></tr></table>
<%
end sub
sub error()
%><br>
<table cellpadding=0 cellspacing=0 border=0 width=95% bgcolor=#777777 align=center>
<tr>
<td>
<table cellpadding=3 cellspacing=1 border=0 width=100%>
<tr align="center">
<td width="100%" bgcolor=#EEEEEE>论坛错误信息</td>
</tr>
<tr>
<td width="100%" bgcolor=#FFFFFF><b>产生错误的可能原因:</b><br><br>
<%=errmsg%>
</td>
</tr>
<tr align="center">
<td width="100%" bgcolor=#EEEEEE>
<a href="javascript:history.go(-1)"> << 返回上一页</a>
</td>
</tr>
</table> </td></tr></table>
<%
end sub
sub Jmail(email)
on error resume next
Dim JMail,SendMail
Set JMail=Server.CreateObject("JMail.SMTPMail")
JMail.Logging=True
JMail.Charset="gb2312"
JMail.ContentType = "text/html"
JMail.ServerAddress=SMTPServer
JMail.Sender=SystemEmail
JMail.Subject=topic
JMail.Body=mailbody
JMail.AddRecipient email
JMail.Priority=3
JMail.Execute
Set JMail=nothing
if err then
SendMail=err.description
err.clear
else
SendMail="OK"
end if
end sub
function IsValidEmail(email)
dim names, name, i, c
'Check for valid syntax in an email address.
IsValidEmail = true
names = Split(email, "@")
if UBound(names) <> 1 then
IsValidEmail = false
exit function
end if
for each name in names
if Len(name) <= 0 then
IsValidEmail = false
exit function
end if
for i = 1 to Len(name)
c = Lcase(Mid(name, i, 1))
if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
IsValidEmail = false
exit function
end if
next
if Left(name, 1) = "." or Right(name, 1) = "." then
IsValidEmail = false
exit function
end if
next
if InStr(names(1), ".") <= 0 then
IsValidEmail = false
exit function
end if
i = Len(names(1)) - InStrRev(names(1), ".")
if i <> 2 and i <> 3 then
IsValidEmail = false
exit function
end if
if InStr(email, "..") > 0 then
IsValidEmail = false
end if
end function
set rs=nothing
conn.close
set conn=nothing
%>
</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -