使用asp实现支持附件的邮件系统


大家经常探讨使用asp,而不使用其他组建能否实现文件的上传,从而开发出支持邮件附件的邮件系统,答案是可以的。请看:

以下是发送邮件的页面,邮件的帐号是员工号,假设是5位的数字,sendmail.asp当然是在合法登陆后才能够看到的


<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<link rel="stylesheet" type="text/css" href="/css/FORUM.CSS"> 
<style type=text/css> 
<!-- 
input { font-size: 9pt; color: #0011dd; background-color: #e9e9f9; padding-top: 0px} 
select { font-size: 9pt; color: #0011dd; background-color: #e9e9f9; padding-top: 0px} 
textarea { font-size: 9pt; color: #0011dd; background-color: #e9e9f9; padding-top: 0px} 
--> 
</style> 
<title>邮件系统</title></head> 
<body bgcolor="#FEF7ED"> 
<script language="javascript"> 
<% 
if session("myid")="" or len(session("myid"))<>5 then 
response.write "window.open('nolog.asp',target='_top');" 
end if 
%> 
function check(theform) 
{

if (theform.geterempl.value=='') 

alert('请输入收件人!'); 
theform.geterempl.focus(); 
return false; 

if (theform.emailtitle.value=='') 

alert('请输入主题!'); 
theform.emailtitle.focus(); 
return false; 

if (theform.emailtitle.value.length>200) 

alert('主题请少于200字节'); 
theform.emailtitle.focus(); 
return false; 

if (theform.body.value.length>15*1024) 

alert('正文请少于16K'); 
theform.body.focus(); 
return false; 

if (theform.emailshowname.value.length>1024) 

alert('签名请少于1K'); 
theform.emailshowname.focus(); 
return false; 
}



</script> 
<% 
meth=request.querystring("meth") 
if meth=1 then 
geterempl=trim(request.querystring("geterempl")) 
emailtitle=trim(request.querystring("emailtitle")) 
elseif meth=2 then 
mailid=trim(request.querystring("mailid")) 
set conn=server.createobject("adodb.connection") 
conn.open "DSN=;UID=;PWD=" 
dsnpath="DSN=;UID=;PWD=" 
set rs=server.createobject("adodb.recordset")


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&"' " 
rs.open selectnew,dsnpath,3,3 
if rs.bof or rs.eof then 
%> 
<script language="javascript"> 
alert("您没有查看这封邮件的权限!"); 
window.history.back(); 
</script> 
<% 
response.end 
else 
body=rs("body") 
emailtitle=rs("emailtitle") 
rs.close 
set rs=nothing 
conn.close 
set conn=nothing 
end if 
end if 
%> 
<Form name="upload_file" onSubmit="return check(this)" action="loadmail.asp" method=post enctype="multipart/form-data" > 
<table width="100%" border="0" cellspacing="2" cellpadding="2"> 
<tr> 
<td width="11%"> 
<div align="right">发件人:</div> 
</td> 
<td width="89%"> 
<input type="hidden" name="senderempl" value="<%=session("myid")%>"> 
<%=session("myid")%> </td> 
</tr> 
<tr> 
<td width="11%"> 
<div align="right">收件人:</div> 
</td> 
<td width="89%"> 
</form>

关于asp邮件收发系统。 %@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="read_mail.aspx.cs" Inherits="read_mail" Title="读邮件" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <div> <table width="800" height="30" border="0" bgcolor="bfdbff"> <tr> <td width="800" align="left" valign="middle"> <asp:ImageButton ID="goback" runat="server" ImageUrl="image/1tuichu.jpg" /> <asp:Button ID="Button1" runat="server" Text="回复" /></td> </tr> </table> <table width="800" border="0" bgcolor="e0edff"> <tr> <td width="120" height="30" align="right">发信人:</td> <td width="666"> <asp:TextBox ID="TextBox1" runat="server" Height="24px" Width="180px"></asp:TextBox></td> </tr> <tr> <td width="120" height="30" align="right">邮件主题:</td> <td> <asp:TextBox ID="TextBox2" runat="server" Height="24px" Width="180px"></asp:TextBox></td> </tr> <tr> <td width="120" height="30" align="right">邮件内容:</td> <td> </td> </tr> </table> <table width="800" height="300" border="0" bgcolor="e0edff"> <tr> <td align="left" valign="top">  <asp:TextBox ID="TextBox3" runat="server" Height="280px" Width="600px"></asp:TextBox></td> </tr> </table> <table width="800" border="0" bgcolor="e0edff"> <tr> <td height="30">        下载附件:</td> </tr> <tr> <td height="150" align="left" valign="top"> <asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None" AutoGenerateColumns="False" DataKeyNames="A_id" <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <RowStyle BackColor="#EFF3FB" /> <EditRowStyle BackColor="#2461BF" /> <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /> <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" /> <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <AlternatingRowStyle BackColor="White" /> <Columns> <asp:TemplateField HeaderText="下载"> <ItemTemplate> <a target="_blank">'>Downloads</a> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="A_name" HeaderText="附件名称" /> </Columns> </asp:GridView> </td> </tr> </table> <table width="800" border="0" bgcolor="#e0edff"> <tr> <td height="30" colspan="2" bgcolor="#bfdbff"> </td> </tr> </table> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </div> </asp:Content>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值