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

80酷酷网    80kuku.com

  大家经常探讨使用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

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: