Using ASP to implement the email system supporting the attachment (1)

Source: Internet
Author: User
Tags dsn file upload implement mail new features trim mail account
We often explore the use of ASP, and do not use other build can achieve file upload, so as to develop a mail system to support mail attachments, the answer is yes.

The following is the page to send the mail, the mail account number is the employee, the assumption is 5 digits, sendmail.asp of course, after the legal landing will be able to see
<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> Mail system </title> <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 (' Please enter the recipient! ');
Theform.geterempl.focus ();
return false;
}
if (theform.emailtitle.value== ')
{
Alert (' Please enter a theme! ');
Theform.emailtitle.focus ();
return false;
}
if (theform.emailtitle.value.length>200)
{
Alert (' Subject please less than 200 bytes ');
Theform.emailtitle.focus ();
return false;
}
if (theform.body.value.length>15*1024)
{
Alert (' Text please less than 16K ');
Theform.body.focus ();
return false;
}
if (theform.emailshowname.value.length>1024)
{
Alert (' sign please less than 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 ("You do not have permission to view this message!") ");
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" 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" to Sender: </div>
</td>
<TD width= "89%" >
<input type= "hidden" name= "Senderempl" value= "<%=session" ("myID")%> ""
<%=session ("myID")%> </td>
</tr>
<tr>
<TD width= "11%" >
<div align= "Right" recipients: </div>
</td>
<TD width= "89%" >
<input type= "text" name= "Geterempl" size= "value=" "<%=geterempl%>"
<input type= "checkbox" Name= "EmailLevel" value= "1" style= "Background-color: #FEF7ED"
Emergency letter </td>
</tr>
<tr>
<TD width= "11%" valign= "top" > </td>
<TD width= "89%", when you send multiple people, you can use the "<font color=" #9999FF ">| </font>" to separate, for example: <font color= "#3399FF" >01234|01235|01236 </font>, The first and last one does not need "<font color=" #9999FF ">| </font>"

<font color= "#FF0000" > new features </font>: You can send the letter directly to you set the <a Href= "group.asp" > a user </a>, sent in the form of: GR: Group number, such as <font color= "#0099FF" >gr:001 </font> </td>
</tr>
<tr>
<TD width= "11%" >
<div align= "right" > </div>
</td>
<TD width= "89%" >
<input type= "checkbox" Name= "Receempl" value= "1" style= "Background-color: #FEF7ED"
Save a copy to Favorites [<font color= "#3399FF" to select this item, the message is sent to each other's mailbox and sent to your favorites </font>] </td>
</tr>
<tr>
<TD width= "11%" valign= "top" > </td>
<TD width= "89%" > </td>
</tr>
<tr>
<TD width= "11%" align= "right" theme: </td>
<TD width= "89%" >
<input type= "text" name= "Emailtitle" size= "value=" "<%=emailtitle%>"
</td>
</tr>
<tr>
<TD width= "11%" valign= "Top"
<div align= "Right", Text: </div>
</td>
<TD width= "89%" >
<textarea name=body rows=8 cols=60> <%=body%> </TEXTAREA>
</td>
</tr>
<tr>
<TD width= "11%" valign= "Top"
<div align= "Right" signature: </div>
</td>
<TD width= "89%" >
<textarea name= "Emailshowname" cols= "rows=" "6" ><%=application (Session ("myID") & "_name")%> </textarea>
</td>
</tr>
<tr>
<TD width= "11%" >
<div align= "Right"
<input type=hidden name= "Fileuploadstart"
Annex 1: </div>
</td>
<TD width= "89%" >
<input type= "File" Name= "file_up" size= "50"
</td>
</tr>
<tr>
<TD width= "11%" >
<div align= "right" Annex 2: </div>
</td>
<TD width= "89%" >
<input type= "File" Name= "File_up1" size= "50"
</td>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.