Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Amministratore L'avatar di Vincent.Zeno
    Registrato dal
    May 2003
    residenza
    Emilia-Romagna (tortellini und cappelletti land!)
    Messaggi
    20,812

    Form contatti via mail + Allegati

    Ciao...
    vorrei far funzionare questo script: è configurato per cdonts e va trasformato per cdosys.
    ma no so che fare...
    Ho eliminato il campo "To", volendo mettere il destinatario nello script (ho fatto male?)
    Qualcuno può aiutarmi?
    codice:
    <%
    'Sample file Form-Email.asp 
    ' Let's you send one an email with one or more attachments.
    
    'Global declarations.
    'Get temporary folder
    Dim ResultHTML
    
    'Create upload form
    'Using Huge-ASP file upload
    'Dim Form: Set Form = Server.CreateObject("ScriptUtils.ASPForm")
    'Using Pure-ASP file upload
    Dim Form: Set Form = New ASPForm %><% 
    
    Server.ScriptTimeout = 1000
    'Do not upload data greater than 10MB. 
    Form.SizeLimit = &HA00000
    
    'Progress bar window will receive the same ID.
    Form.UploadID = Request.QueryString("UploadID")'{/b}
    
    Const fsCompletted  = 0
    
    If Form.State = fsCompletted Then 'Completted
      ResultHTML = ProcessForm
    ElseIf Form.State > 10 then
      Const fsSizeLimit = &HD
      Select case Form.State
    		case fsSizeLimit: ResultHTML = "
    <Font Color=red>Source form size (" & Form.TotalBytes & "B) exceeds form limit (" & Form.SizeLimit & "B)</Font>
    "
    		case else ResultHTML = "
    <Font Color=red>Some form error.</Font>
    "
      end Select
    End If 
    if request.QueryString("Action") = "Cancel" then
    	ResultHTML = "
    Upload was cancelled"
    end if
    
    Function TempFolder()
    	Dim FS
      Set FS = CreateObject("Scripting.FileSystemObject")
      'Get temporary folder
      TempFolder = FS.GetSpecialFolder(2) & "\emailtemp"
    End Function
    
    Sub DeleteFile(FileName)
    	Dim FS
      Set FS = CreateObject("Scripting.FileSystemObject")
    	FS.DeleteFile FileName
    End Sub
    
    
    
    
    Function ProcessForm
      Dim eFrom, eTo, Subject, Message
    
      'get source form fields - From, To, Subject and Message
      eFrom = Form("From")
      eTo = mio@indirizzo.it 'va bene se definisco l'indirizzo qui, senza mettere il form?
      Subject = Form("Subject")
      Message = Form("Message")
      
      Dim HTML
      HTML = "
    <Font Color=red>_____Server-side ASP script accepted source form with fields and files and email object was created. "
      HTML = HTML & "
    From: " & eFrom & ""
      HTML = HTML & "
    To: " & eTo & ""
      HTML = HTML & "
    Subject: " & Subject & ""
      HTML = HTML & "
    Message: " & Message & ""
    
      Dim objNewMail, File, FileName
    
      'Create a new email message
      Set objNewMail = CreateObject("CDONTS.NewMail")
      Const CdoMailFormatMime = 0
      objNewMail.MailFormat = CdoMailFormatMime
      'Save source files to temporary folder
      'Add these files to the new e-mail
    	HTML = HTML & "
    Attachments:"
      For Each File In Form.Files.Items
    
        'If source file is specified.
        If Len(File.FileName) > 0 Then
    
    		  HTML = HTML & "
    " & File.Name & ": " & File.FileName & ", " & File.Length \ 1024 & "kB"
          FileName = TempFolder & "\" & File.FileName 
        
          File.SaveAs FileName
          
          objNewMail.AttachFile FileName
        End If
      Next
      
      'Send the new email
      objNewMail.Send eFrom, eTo, Subject, Message
    
      'delete temporary files
      For Each File In Form.Files.Items
        If Len(File.FileName) > 0 Then
          FileName = TempFolder & "\" & File.FileName
          on error resume next
          DeleteFile FileName
        End If
      Next
      HTML = HTML & "</Font>
    "
      ProcessForm = HTML
    End Function
    
    
    
    '{b}get an unique upload ID for this upload script and progress bar.
    Dim UploadID, PostURL
    UploadID = Form.NewUploadID
    
    'Send this ID as a UploadID QueryString parameter to this script.
    PostURL = Request.ServerVariables("SCRIPT_NAME") & "?UploadID=" & UploadID'{/b}
    %>  
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
     <TITLE>.............</TITLE>
     <STYLE TYPE="text/css"></STYLE>
     <meta name="robots" content="noindex,nofollow">
    </HEAD>
    <BODY BGColor=white>
    
    
    <Div style=width:600>
    
    <TABLE cellSpacing=2 cellPadding=1 width="100%" bgColor=white border=0>
      
      <TR>
        <TD colSpan=2>
          
    
    Temporary folder for e-mail file attachments is <%=TempFolder%>
      </P>
      </TD></TR></TABLE>
    <%=ResultHTML%>
    
    <TABLE cellSpacing=1 cellPadding=3 bordercolor=silver bgcolor=GAINSBORO width="100%" border=1>
    <form method="post" ENCTYPE="multipart/form-data" OnSubmit="return ProgressBar();" Action="<%=PostURL%>">
      <TBODY>
      <tr><td> From : </td><td><input Name=From Size=50 value="<%=Form("From")%>"></td></tr>
    
      <tr><td> To : </td><td></td></tr>
    
      <tr><td> Subject : </td><td><input Name=Subject Size=80  value="<%=Form("Subject")%>"></td></tr>
    
      <tr><td ColSpan=2> Message:
        
    <TEXTAREA name=Message rows=6 cols=76><%=Form("Message")%></TEXTAREA>
      </td></tr>
    
      <tr><td ColSpan=2>File attachments:
         Form size limit is <%=Form.SizeLimit%>B (<%=Form.SizeLimit \ 1024 %>kB).
    
        <DIV ID=files>
           Attachment 1 : <input type="file" name="File 1">
        </DIV>
        <INPUT Type=button Value="Aggiungi file" OnClick=return(Expand()) 
         Style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BACKGROUND: yellow; BORDER-LEFT: 0px; CURSOR: hand; BORDER-BOTTOM: 0px">
      </td></tr>
    
      <tr><td ColSpan=2 Align=right>
        <input Name=SubmitButton Value="Invia email &gt;&gt;" Type=submit>
        </td></tr>
      </form></TBODY>
    </TABLE>
    
    
    
    
    <SCRIPT>
    //Script to add an attachment file field 
    var nfiles = 1;
    function Expand(){
      nfiles++
      var adh = '
     Attachment '+nfiles+' : <input type="file" name="File '+nfiles+'">';
      files.insertAdjacentHTML('BeforeEnd',adh);
      return false;
    };
    
    //Open a window with progress bar indicator.
    function ProgressBar(){
      var ProgressURL
      ProgressURL = 'progress.asp?UploadID=<%=UploadID%>'
    
      var v = window.open(ProgressURL,'_blank','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=350,height=200')
      
      return true;
    }
    </SCRIPT>
    
    </Div>
    </BODY></HTML>

  2. #2

  3. #3
    Amministratore L'avatar di Vincent.Zeno
    Registrato dal
    May 2003
    residenza
    Emilia-Romagna (tortellini und cappelletti land!)
    Messaggi
    20,812
    Roby... grazie.

    purtroppo c'è qualcosa che mi sfugge (grazie alla mia ingnoranza di asp)...

    ho fatto qualche prova ma senza esito..

    qualcuno potrebbe aiutarmi concretamente?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.