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

Source: Internet
Author: User
Tags format chr implement trim
Attempt to send a message, but failed, please modify the error and try again!

<script language= "JavaScript" >
Alert ("The collection group you entered is malformed!") \ r The correct format is: ' gr:001 ' ");
History.back ();
</script>
<p>
<%
Response.End
Else
Thegroup= (Mid (Trim (Strfieldvalue), 4))
End If
End If

Tmpsql= "SELECT * from T_group where owner= '" &session ("myID") & "' and Groupidowner= '" &thegroup& ""
' Response.Write Tmpsql
Set Tmprs=server. CreateObject ("ADODB.") Recordset ")
Tmprs. Open Tmpsql,conn
If Tmprs.bof or tmprs.eof then
' The group was not found
%>
Attempt to send a message, but failed, please modify the error and try again!
<script language= "JavaScript" >
Alert ("The collection group you entered <%=thegroup%> was not found!") ");
History.back ();
</script>
<p>
<%
Response.End
Else
If Tmprs ("Personnum") =0 Then
' No users in group
%>
Attempt to send a message, but failed, please modify the error and try again!
<script language= "JavaScript" >
Alert ("You have entered a collection group <%=thegroup%> that currently does not have any users \ nthe cannot send");
History.back ();
</script>
<p>
<%
Response.End
Else
Strfieldvalue=trim (Tmprs ("Groupempl"))
Tmprs.close
Set tmprs=nothing
End If
End If
End If

If InStr (Strfieldvalue, "|") Then
' Group Hair
Allsearch=replace (Trim (strfieldvalue), "|", "', '")
Allsearch= "'" &allsearch& ""
Tmpstring=trim (strfieldvalue) & "|"
Tosearch= ""
Do While Len (tmpstring) >=5

Tosearch=left (tmpstring,5)
Tmpstring=mid (tmpstring,7)
If InStr (Tosearch, "|") Then
' Bad format
%>
Attempt to send a message, but failed, please modify the error and try again!
<script language= "JavaScript" >
Alert ("The recipient you entered is malformed!");
History.back ();
</script>
<p>
<%
Response.End
End If

Tmpsql= "SELECT * from" (select UserID to T_officer where UserID in ("&allsearch&")) Derivedtbl where userid= ' "&am p;tosearch& "'"
' Response.Write Tmpsql
Set Tmprs=server. CreateObject ("ADODB.") Recordset ")
Tmprs. Open Tmpsql,conn
If tmprs.eof or Tmprs.bof then
%>
Attempt to send a message, but failed, please modify the error and try again!
<script language= "JavaScript" >
Alert ("The recipient you entered is <%=tosearch%> not found!");
History.back ();
</script>
<p>
<%
Response.End
End If
Tmprs.close
Set tmprs=nothing
Loop
Strfieldvalue=trim (Strfieldvalue)

Else
If Len (Trim (strfieldvalue)) <> 5 Then
' Not properly formatted
%>
Attempt to send a message, but failed, please modify the error and try again!
<script language= "JavaScript" >
Alert ("The recipient you entered <%=trim (strfieldvalue)%> incorrect!");
History.back ();
</script>
<p>
<%
Response.End
Else
If IsNumeric (the trim (strfieldvalue)) Then


Tmpsql= "SELECT * from T_officer where userid= '" &trim (strfieldvalue) & ""

Set Tmprs=server. CreateObject ("ADODB.") Recordset ")
Tmprs. Open Tmpsql,conn
If tmprs.eof or Tmprs.bof then
%>
Attempt to send a message, but failed, please modify the error and try again!
<script language= "JavaScript" >
Alert ("The recipient you entered <%=trim (Strfieldvalue)%> did not find \ r The employee may not have been registered!");
History.back ();
</script>
<p>
<%
Response.End
End If
Tmprs.close
Set tmprs=nothing


Strfieldvalue=trim (Strfieldvalue)
Else
%>
Attempt to send a message, but failed, please modify the error and try again!
<script language= "JavaScript" >
Alert ("The recipient you entered <%=trim (strfieldvalue)%> incorrect!");
History.back ();
</script>

<p> <%
Response.End
End If
End If
End If

End If
Strfieldvalue=replace (Strfieldvalue, "", "") "
' Response.Write strFieldName
RS (strfieldname) =replace (Strfieldvalue, ">", ">")

Binhttpheader=midb (BINHTTPHEADER,INSTRB (Datastart + 1, Binhttpheader, divider))

Loop
' Start working with file data


Titem=0
RS ("Filesize_1") =0
RS ("filesize_2") =0
RS ("Filesize_3") =0



Do While LenB (Binhttpheader) >46

If INSTRB (Binhttpheader, Bncrlf & Bncrlf) <> 0 Then
Binheaderdata = LeftB (BINHTTPHEADER,INSTRB (Binhttpheader, Bncrlf & Bncrlf)-1)
Else
Exit Do
End If
Strheaderdata=bin2str (Binheaderdata)


' Read Content-type of uploaded files
Lngfilecontenttypestart=instr (Strheaderdata, "Content-type:") +len ("Content-type:")
Strfilecontenttype=trim (Mid (Strheaderdata,lngfilecontenttypestart))
Strfilecontenttype=replace (strfilecontenttype,vbcrlf,vbnullstring)

' Read the uploaded file name
If InStr (Strheaderdata, "filename=") >0 Then
Lngfilenamestart=instr (Strheaderdata, "filename=" &AMP;CHR) +len ("Filename=" &AMP;CHR (34))
Lngfilenameend=instr (LNGFILENAMESTART,STRHEADERDATA,CHR (34))
Strfilename=mid (Strheaderdata,lngfilenamestart,lngfilenameend-lngfilenamestart)
Strfilename=trim (strFileName)
Strfilename=replace (strfilename,vbcrlf,vbnullstring)
Else
Strfilename= ""
End If

' Read uploaded file data
Datastart = INSTRB (Binhttpheader, Bncrlf & Bncrlf) + 4
Dataend = INSTRB (Datastart + 1, Binhttpheader, divider)-Datastart

If strfilename <> "" Then
If Dataend>0 Then
Binfieldvalue=midb (Binhttpheader, Datastart, Dataend)
' Write uploaded files to the database
Titem=titem+1
' Response.Write ' TItem: "&titem
RS ("Filecontenttype_" &titem) =strfilecontenttype
RS ("Filecontent_" &titem). AppendChunk Binfieldvalue
RS ("Filesize_" &



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.