Perchè non riesco a far funzionare l'invio di un allegato via email, tramite server? nessun errore... non trova la pagina:
codice:
http://www.paginaweb/public/sendmail.asp?func=2
Codice:
codice:
<%     
    response.buffer=true
    Func = Request("Func")
    	
	if isempty(Func) then
    		Func = 1
	end if

   Select case Func
		case 1
    %>

<FORM ENCTYPE="multipart/form-data" ACTION="sendmail.asp?func=2" METHOD=post id=form1 name=form1>

<%
    
		case 2
			ForWriting = 2
    			adLongVarChar = 201
    			lngNumberUploaded = 0
    	
					
    			noBytes = Request.TotalBytes 
    				binData = Request.BinaryRead (noBytes)
    
    			Set RST = CreateObject("ADODB.Recordset")
    				LenBinary = LenB(binData)
    	
    					if LenBinary > 0 then
    						RST.Fields.Append "myBinary", adLongVarChar, LenBinary
    							RST.Open
    								RST.AddNew
    									RST("myBinary").AppendChunk BinData
    								RST.Update
    						strDataWhole = RST("myBinary")
    					End If
  

    strBoundry = Request.ServerVariables ("HTTP_CONTENT_TYPE")
    lngBoundryPos = instr(1,strBoundry,"boundary=") + 8 
    strBoundry = "--" & right(strBoundry,len(strBoundry)-lngBoundryPos)
    

    lngCurrentBegin = instr(1,strDataWhole,strBoundry)
    lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1

do while lngCurrentEnd > 0
			strData = mid(strDataWhole,lngCurrentBegin, lngCurrentEnd - lngCurrentBegin)
				strDataWhole = replace(strDataWhole,strData,"")
    			

    		lngBeginFileName = instr(1,strdata,"filename=") + 10
    			lngEndFileName = instr(lngBeginFileName,strData,chr(34)) 
	
    		if lngBeginFileName = lngEndFileName and lngNumberUploaded = 0 then
    	
    			Response.Write "<h2> The following error occured.</h2>"
    			Response.Write "You must select at least one file to upload"
    			Response.Write "

Hit the back button, make the needed corrections and resubmit your information."
    			Response.Write "

<input type='button' onclick='history.go(-1)' value='<< Back' id='button'1 name='button'1>"
    			Response.End 
    	
    		end if

    		strFilename = mid(strData,lngBeginFileName,lngEndFileName - lngBeginFileName)
    
    		tmpLng = instr(1,strFilename,"\")
    			
    			do while tmpLng > 0
    				PrevPos = tmpLng
    				tmpLng = instr(PrevPos + 1,strFilename,"\")
    			loop
    		
    				FileName = right(strFilename,len(strFileName) - PrevPos)
    	
    			lngCT = instr(1,strData,"Content-Type:")
    	
    				if lngCT > 0 then
    					lngBeginPos = instr(lngCT,strData,chr(13) & chr(10)) + 4
    						
    						else
    			 				lngBeginPos = lngEndFileName
    				end if
    
		
    		lngEndPos = len(strData) 
    		
				
    		lngDataLenth = lngEndPos - lngBeginPos
					
    			strFileData = mid(strData,lngBeginPos,lngDataLenth)
				
				
    			Set fso = CreateObject("Scripting.FileSystemObject")
    				Set f = fso.OpenTextFile(server.mappath("upload") & "\" & FileName, ForWriting, True)
    					f.Write strFileData
    
	
    					Dim ThisFile
    				ThisFile = server.MapPath("upload") & "/" & filename
    
       			lngNumberUploaded = lngNumberUploaded + 1

  		    set f = nothing
   			
   		lngCurrentBegin = instr(1,strDataWhole,strBoundry)
	    lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1
loop
    	

    Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
    

		with objCDOMail
			.Body = "TestMailtje met attachment!"
			.Subject = "testing 123"
			.From = "postmaster@com.com"
			.To = "postmaster@com.com"
				
			.MailFormat = 0			
			.AttachFile ThisFile
			.Send
		end with
	
   set objCDOMail = nothing
    
    fso.DeleteFile ThisFile
    
    set fso = nothing
        		
    		Response.Write "Uw mail is verstuurd!</h2>"
    		Response.Write "

<input type='button' onclick='document.location=" & chr(34) & "sendmail.asp" & chr(34) & "' value='<< Back' id='button'1 name='button'1>"	 						
    	
end select	
    
  
    %></FORM>