?? 使用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 + -