📄 使用asp实现支持附件的邮件系统(一).htm
字号:
colSpan=2><B>使用asp实现支持附件的邮件系统(一)</B></FONT><BR>2002-2-25 动网先锋
</TD></TR>
<TR>
<TD class=p4 colSpan=2>
<BLOCKQUOTE><BR>大家经常探讨使用asp,而不使用其他组建能否实现文件的上传,从而开发出支持邮件附件的邮件系统,答案是可以的。请看:
<P></P>
<P>以下是发送邮件的页面,邮件的帐号是员工号,假设是5位的数字,sendmail.asp当然是在合法登陆后才能够看到的</P>
<P><BR><html><BR><head><BR><meta
http-equiv="Content-Type" content="text/html;
charset=gb2312"><BR><link rel="stylesheet" type="text/css"
href="/css/FORUM.CSS"><BR><style
type=text/css><BR><!--<BR>input { font-size: 9pt; color:
#0011dd; background-color: #e9e9f9; padding-top: 0px}<BR>select {
font-size: 9pt; color: #0011dd; background-color: #e9e9f9;
padding-top: 0px}<BR>textarea { font-size: 9pt; color: #0011dd;
background-color: #e9e9f9; padding-top:
0px}<BR>--><BR></style><BR><title>邮件系统</title></head><BR><body
bgcolor="#FEF7ED"><BR><script
language="javascript"><BR><%<BR>if session("myid")="" or
len(session("myid"))<>5 then<BR>response.write
"window.open('nolog.asp',target='_top');"<BR>end
if<BR>%><BR>function check(theform)<BR>{</P>
<P>if
(theform.geterempl.value=='')<BR>{<BR>alert('请输入收件人!');<BR>theform.geterempl.focus();<BR>return
false;<BR>}<BR>if
(theform.emailtitle.value=='')<BR>{<BR>alert('请输入主题!');<BR>theform.emailtitle.focus();<BR>return
false;<BR>}<BR>if
(theform.emailtitle.value.length>200)<BR>{<BR>alert('主题请少于200字节');<BR>theform.emailtitle.focus();<BR>return
false;<BR>}<BR>if
(theform.body.value.length>15*1024)<BR>{<BR>alert('正文请少于16K');<BR>theform.body.focus();<BR>return
false;<BR>}<BR>if
(theform.emailshowname.value.length>1024)<BR>{<BR>alert('签名请少于1K');<BR>theform.emailshowname.focus();<BR>return
false;<BR>}</P>
<P><BR>}<BR></script><BR><%<BR>meth=request.querystring("meth")<BR>if
meth=1
then<BR>geterempl=trim(request.querystring("geterempl"))<BR>emailtitle=trim(request.querystring("emailtitle"))<BR>elseif
meth=2 then<BR>mailid=trim(request.querystring("mailid"))<BR>set
conn=server.createobject("adodb.connection") <BR>conn.open
"DSN=;UID=;PWD=" <BR>dsnpath="DSN=;UID=;PWD=" <BR>set
rs=server.createobject("adodb.recordset")
<BR><BR><BR>selectnew="select * from t_mail where ((geterempl like
'%"&session("myid")&"%' or deleempl like
'%"&session("myid")&"%' or receempl like
'%"&session("myid")&"%')and (not deleverempl like
'%"&session("myid")&"%')) and mailid='"&mailid&"'
" <BR>rs.open selectnew,dsnpath,3,3<BR>if rs.bof or rs.eof
then<BR>%><BR><script
language="javascript"><BR>alert("您没有查看这封邮件的权限!");<BR>window.history.back();
<BR></script><BR><%<BR>response.end<BR>else<BR>body=rs("body")<BR>emailtitle=rs("emailtitle")
<BR>rs.close<BR>set rs=nothing<BR>conn.close<BR>set
conn=nothing<BR>end if<BR>end if<BR>%><BR><Form
name="upload_file" onSubmit="return check(this)"
action="loadmail.asp" method=post enctype="multipart/form-data"
><BR><table width="100%" border="0" cellspacing="2"
cellpadding="2"><BR><tr> <BR><td width="11%">
<BR><div
align="right">发件人:</div><BR></td><BR><td
width="89%"> <BR><input type="hidden" name="senderempl"
value="<%=session("myid")%>"><BR><%=session("myid")%>
</td><BR></tr><BR><tr> <BR><td
width="11%"> <BR><div
align="right">收件人:</div><BR></td><BR><td
width="89%"> <BR><input type="text" name="geterempl"
size="40" value="<%=geterempl%>"><BR><input
type="checkbox" name="emaillevel" value="1"
style="background-color: #FEF7ED"><BR>紧急信件
</td><BR></tr><BR><tr> <BR><td width="11%"
valign="top"> </td><BR><td
width="89%">发送多个人的时候可以使用"<font
color="#9999FF">|</font>"隔开,例如:<font
color="#3399FF">01234|01235|01236</font>,第一位和最后一位不需要"<font
color="#9999FF">|</font>"<br><BR><font
color="#FF0000">新功能</font>:您可以把信信直接发送给您设定的<a
href="group.asp">某用户</a>,发送格式为:gr:组序号,例如<font
color="#0099FF">gr:001</font></td><BR></tr><BR><tr>
<BR><td width="11%"> <BR><div
align="right"></div><BR></td><BR><td
width="89%"> <BR><input type="checkbox" name="receempl"
value="1" style="background-color:
#FEF7ED"><BR>保存一份到收藏夹[<font
color="#3399FF">选定此项,则邮件发送到对方邮箱的同时发送到自己的收藏夹里</font>]</td><BR></tr><BR><tr>
<BR><td width="11%" valign="top"> </td><BR><td
width="89%"> </td><BR></tr><BR><tr>
<BR><td width="11%" align="right"> 主题:</td><BR><td
width="89%"> <BR><input type="text" name="emailtitle"
size="60"
value="<%=emailtitle%>"><BR></td><BR></tr><BR><tr>
<BR><td width="11%" valign="top"> <BR><div
align="right">正文:</div><BR></td><BR><td
width="89%"> <BR><TEXTAREA name=body rows=8
cols=60><%=body%></TEXTAREA><BR></td><BR></tr><BR><tr>
<BR><td width="11%" valign="top"> <BR><div
align="right">签名:</div><BR></td><BR><td
width="89%"> <BR><textarea name="emailshowname" cols="30"
rows="6"><%=application(session("myid")&"_name")%></textarea><BR></td><BR></tr><BR><tr>
<BR><td width="11%"> <BR><div align="right">
<BR><input type=hidden name="FileUploadStart"><BR>附件1:
</div><BR></td><BR><td width="89%">
<BR><input type="file" name="file_up"
size="50"><BR></td><BR></tr><BR><tr>
<BR><td width="11%"> <BR><div
align="right">附件2:</div><BR></td><BR><td
width="89%"> <BR><input type="file" name="file_up1"
size="50"><BR></td><BR></tr><BR><tr>
<BR><td width="11%"> <BR><div
align="right">附件3:</div><BR></td><BR><td
width="89%"> <BR><input type="file" name="file_up2"
size="50"><BR><input type=hidden
name="FileUploadEnd"><BR></td><BR></tr><BR><tr>
<BR><td width="11%"> <BR><div
align="right"></div><BR></td><BR><td
width="89%"> <BR><input type=submit value=确定
><BR></td><BR></tr><BR></table><BR></Form><BR></body><BR></html>
<BR><BR></P></BLOCKQUOTE></TD></TR>
<TR>
<TD class=p4 vAlign=top width="50%">
<BLOCKQUOTE>原作者:sonic_qd<BR>来 源:开发者俱乐部<BR>共有6147位读者阅读过此文<BR>【<A
href="http://bbs.aspsky.net/list.asp?boardid=1">发表评论</A>】
</BLOCKQUOTE></TD>
<TD class=p4 vAlign=top width="50%">
<P>
<LI><FONT color=#0772b1>上篇文章</FONT>:<A
href="http://www.aspsky.net/article/list.asp?id=2614">检查当前目录下是否存在指定的文件,如果存在就重新命名</A>
<BR>
<LI><FONT color=#0772b1>下篇文章</FONT>:<A
href="http://www.aspsky.net/article/list.asp?id=2616">使用asp实现支持附件的邮件系统(二)</A>
</LI></TD></TR>
<TR>
<TD bgColor=#297dff class=p4 height=20 width="50%"><FONT
color=#ceffff> → 本周热门</FONT></TD>
<TD bgColor=#297dff class=p4 width="50%"><FONT color=#ceffff> →
相关文章</FONT></TD></TR>
<TR>
<TD bgColor=#586011 colSpan=2 height=1><SPACER type="block"
width="1"></TD></TR>
<TR>
<TD colSpan=2 height=7></TD></TR>
<TR>
<TD class=p4 vAlign=top width="50%">
<LI><A href="http://www.aspsky.net/article/list.asp?id=1510"
target=_top title="SQL Server 7.0 入门(一)">SQL Server 7.0
入门(...</A>[<FONT color=red>7239</FONT>]<BR>
<LI><A href="http://www.aspsky.net/article/list.asp?id=1540"
target=_top title=PHP4实际应用经验篇(1)>PHP4实际应用经验篇(1)</A>[<FONT
color=red>7135</FONT>]<BR>
<LI><A href="http://www.aspsky.net/article/list.asp?id=1536"
target=_top
title=无组件文件上传代码实例(支持多文件上传及文件和input域混合上传)>无组件文件上传代码实例(支持多文件上...</A>[<FONT
color=red>6029</FONT>]<BR>
<LI><A href="http://www.aspsky.net/article/list.asp?id=2557"
target=_top title=树型结构在ASP中的简单解决>树型结构在ASP中的简单解决</A>[<FONT
color=red>5757</FONT>]<BR>
<LI><A href="http://www.aspsky.net/article/list.asp?id=1545"
target=_top title=PHP4实际应用经验篇(6)>PHP4实际应用经验篇(6)</A>[<FONT
color=red>5599</FONT>]<BR>
<LI><A href="http://www.aspsky.net/article/list.asp?id=2563"
target=_top title=一个老个写的无组件上传>一个老个写的无组件上传</A>[<FONT
color=red>5013</FONT>]<BR>
<LI><A href="http://www.aspsky.net/article/list.asp?id=1542"
target=_top title=PHP4实际应用经验篇(3)>PHP4实际应用经验篇(3)</A>[<FONT
color=red>4731</FONT>]<BR></LI></TD>
<TD class=p4 vAlign=top width="50%">
<LI><A
href="http://www.aspsky.net/article/list.asp?id=2617">使用asp实现支持附件的邮件系统(三)</A><BR>
<LI><A
href="http://www.aspsky.net/article/list.asp?id=2616">使用asp实现支持附件的邮件系统(二)</A><BR>
<LI><A
href="http://www.aspsky.net/article/list.asp?id=2615">使用asp实现支持附件的邮件系统(一)</A><BR></LI></TD></TR>
<TR>
<TD colSpan=2 height=7></TD></TR></TBODY></TABLE>
<TD bgColor=#297dff width=1> </TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=755>
<TBODY>
<TR>
<TD bgColor=#297dff height=1><SPACER type="block"
width="1"></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=755>
<TBODY>
<TR>
<TD align=middle height=30></TD></TR></TBODY></TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=755>
<TBODY>
<TR>
<TD align=middle class=p2 width="100%">
<TABLE border=0 cellPadding=0 cellSpacing=0 width=755>
<TBODY>
<TR>
<TD align=middle class=p2 width="100%">
<P align=center><A
href="http://www.aspsky.net/produce/index.asp">客户服务</A> -- <A
href="http://www.aspsky.net/aspads.asp">广告合作</A> -- <A
href="http://www.aspsky.net/about.asp">关于本站</A> -- <A
href="http://www.aspsky.net/tell.asp">联系方法</A><BR><BR>动网先锋版权所有 <FONT
face=Verdana, size=1 Arial, Helvetica, sans-serif>Copyright ©
2000-2001 <B>AspSky<FONT color=#cc0000>.Net</FONT></B>, All Rights
Reserved .</FONT>
</P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></CENTER></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -