Visualizzazione dei risultati da 1 a 8 su 8
  1. #1

    Recuperare i campi tramite l'upload di Baol

    Ciao ragazzi risolto il problema dell'invio con 3 allegati.

    Ora però mi si è presentato il problema del recupero dei valori del form e della loro scrittura nel corpo della mail.
    So che con con l'upload di Baol nn si utilizza il Request.form ma oUpload.form e perciò ho usato quest'ultimo merodo, ma mi restituisce errore.
    Questo è il form:
    codice:
    <form id="form1" name="form1" method="POST" action="<%=MM_editAction%>">
          <table width="500" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td colspan="3" align="left" class="moduli">Benvenuto Sig.: <%=(rsUtenti.Fields.Item("nome").Value)%><%=(rsUtenti.Fields.Item("cognome").Value)%></td>
            </tr>
            <tr>
              <td colspan="3" align="center"><span class="moduli">[img]immagini/null.gif[/img]</span></td>
            </tr>
            <tr>
              <td colspan="3" align="center" class="titoli">Modulo richiesta nuovo punto vendita Bose </td>
            </tr>
            <tr>
              <td colspan="3"><span class="moduli">[img]immagini/null.gif[/img]</span></td>
            </tr>
            <tr>
              <td colspan="3" align="left" class="moduli">Ragione Sociale
                <label></label></td>
              </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
              </tr>
            <tr>
              <td colspan="3" align="left" class="moduli"><input name="ragioneSociale" type="text" class="moduli" id="ragioneSociale" size="40" /></td>
              </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td colspan="3" align="left" class="moduli">Sede Legale via/Piazza</td>
              </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td colspan="3" align="left" class="moduli"><input name="sedeLegale" type="text" class="moduli" id="sedeLegale" size="40" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td colspan="3" class="moduli"><table width="500" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="94" align="left">CAP</td>
                  <td width="287" align="left">Citt&agrave;</td>
                  <td width="119" align="left">Provincia</td>
                </tr>
                <tr>
                  <td colspan="3">[img]immagini/null.gif[/img]</td>
                  </tr>
                <tr>
                  <td align="left"><label>
                    <input name="cap" type="text" class="moduli" id="cap" size="10" />
                  </label></td>
                  <td align="left"><input name="citta" type="text" class="moduli" id="citta" size="42" /></td>
                  <td align="left"><input name="provincia" type="text" class="moduli" id="provincia" size="5" /></td>
                </tr>
                <tr>
                  <td colspan="3">[img]immagini/null.gif[/img]</td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">Telefono:</td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td colspan="3" align="left" class="moduli"><input name="telefono" type="text" class="moduli" id="telefono" size="40" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td colspan="3" class="moduli"><table width="500" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="241" align="left">Partita IVA / Codice Fiscale </td>
                  <td width="259" align="left">Rappresentata dal Sig. </td>
                  </tr>
                <tr>
                  <td colspan="2">[img]immagini/null.gif[/img]</td>
                </tr>
                <tr>
                  <td align="left"><label>
                    <input name="partitaIva" type="text" class="moduli" id="partitaIva" size="35" />
                  </label></td>
                  <td align="left"><input name="sig" type="text" class="moduli" id="sig" size="42" /></td>
                  </tr>
                <tr>
                  <td colspan="2">[img]immagini/null.gif[/img]</td>
                </tr>
              </table></td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli">URL del sito web (Se esistente) </td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli"><input name="urlweb" type="text" class="moduli" id="urlweb" size="42" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli">Indirizzo e-mail </td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli"><input name="email" type="text" class="moduli" id="email" size="42" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli">Data:</td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli"><input name="data" type="text" class="moduli" id="data" size="20" /> 
                Formato: gg/mm/aaaa </td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            
            <tr>
              <td colspan="3" align="center" class="moduli">Foto del negozio </td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
    
            <tr>
              <td width="100" align="right" class="moduli">Foto 1:</td>
              <td width="20" class="moduli"></td>
              <td width="380" class="moduli"><input name="file1" type="file" class="moduli" size="35" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td align="right" class="moduli">Foto 2:</td>
              <td class="moduli"></td>
              <td class="moduli"><input name="file1" type="file" class="moduli" size="35" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td align="right" class="moduli">Foto 3:</td>
              <td class="moduli"></td>
              <td class="moduli"><input name="file1" type="file" class="moduli" size="35" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]
                <input name="agente" type="hidden" id="agente" value="<%=(rsUtenti.Fields.Item("id").Value)%>" /></td>
            </tr>
            <tr>
              <td class="moduli"></td>
              <td class="moduli"></td>
              <td class="moduli"><label>
                <input name="Submit" type="reset" class="moduli" value="Ripristina" />
              
              <input name="Submit2" type="submit" class="moduli" value="Invia" />
              </label></td>
            </tr>
          </table>
            
          <input type="hidden" name="MM_insert" value="form1">
        </form>
    Questo è l'upolad:
    codice:
    <%
    Dim form, subject, allegato1, allegato2, allegato3
    %>
    <%
    Dim oUpload 
    Set oUpload = new cUpload
    oUpload.SetPath "upload\"
    oUpload.Load
    if oUpload.Count=0 then
    	allegato1 = ""
    	allegato2 = ""
    	allegato3 = ""
    Else
    	While Not oUpload.EOF
    		oUpload.Save()
    		Select Case lCase(oUpload.Files("InputName"))
    		Case "file1"
                    allegato1 = oUpload.GetFileName()
    		Case "file2"		
    				allegato2 = oUpload.GetFileName()
    		Case "file3"		
    				allegato3 = oUpload.GetFileName()
    		End Select
    		oUpload.MoveNext
    	Wend
    End if
    
    
    
    call Main()
    
    
    
    Sub Main()
    If Len(oUpload.Form("subject")) = 0 then
    no_sub()
    else 
    manda_posta(form)
    ecco_fatto(nome)
    end if
    Set oUpload=Nothing 
    End sub
    
    Sub manda_posta(form)
    Dim subject, testo
    Dim objMail, objMailConfig
    subject = oUpload.Form("Richiesta nuovo punto vendita Bose")
    mittente = oUpload.Form("mittente")
    ragioneSociale = oUpload.Form("ragioneSociale")
    sedeLegale = oUpload.Form("sedeLegale")
    cap = oUpload.Form("cap")
    citta = oUpload.Form("citta")
    provincia = oUpload.Form("provincia")
    telefono = oUpload.Form("telefono")
    partitaIva = oUpload.Form("partitaIva")
    sig = oUpload.Form("sig")
    urlweb = oUpload.Form("urlweb")
    email = oUpload.Form("email")
    data = oUpload.Form("data")
    Set objMail = Server.CreateObject("CDO.Message")
    Set objMailConfig = Server.CreateObject ("CDO.Configuration")
    
    ' Proprietà di invio
    with objMailConfig
      ' SMTP mail server
      .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.eurnetcity.net"
      ' SMTP port
      .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
      ' CDO port
      .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      ' Timeout
      .Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
      .Fields.Update
    end with
    
    Set objMail.Configuration = objMailConfig
    
    objMail.From = "pippo@mail.it"
    objMail.To = "pippo@mail.it"
    objMail.cc = oUpload.Form("destinatario")
    objMail.Subject = subject
    objMail.TextBody = "Ragione Sociale:" & Trim(oUpload.Form("ragioneSociale")) & vbcrlf & "Sede Legale - via/Piazza:" & Trim(oUpload.Form("sedeLegale")) & vbcrlf & "CAP:" & Trim(oUpload.Form("cap")) & vbcrlf &  "Città:" & Trim(oUpload.Form("citta")) & vbcrlf & "Provincia:" & Trim(oUpload.Form("provincia")) & vbcrlf & "Telefono:" & Trim(oUpload.Form("telefono")) & vbcrlf & "Partita IVA / Codie Fiscale:" & Trim(oUpload.Form("partitaIva")) & vbcrlf & "Rappresentata dal Sig:" & Trim(oUpload.Form("sig")) & vbcrlf & "URL del sito Web:" & Trim(oUpload.Form("urlWeb")) & vbcrlf & "Indirizzo e-mail:" & Trim(oUpload.Form("email")) & vbcrlf & "Data:" & Trim(oUpload.Form("data"))
    If Len(allegato1) <> 0 then
    objMail.AddAttachment Server.MapPath("upload\" & allegato1)
    end if
    If Len(allegato2) <> 0 then
    objMail.AddAttachment Server.MapPath("upload\" & allegato2)
    end if
    If Len(allegato3) <> 0 then
    objMail.AddAttachment Server.MapPath("upload\" & allegato3)
    end if
    objMail.Fields("urn:schemas:httpmail:importance").Value = 0
    objMail.Fields.update() 
    objMail.Send
    Set objMail = Nothing
    end sub
    
    %>
    L'errore che mi restituisce è il seguente:

    Request object error 'ASP 0206 : 80004005'
    Cannot call BinaryRead
    /testModuli/upload.asp, line 275
    Cannot call BinaryRead after using Request.Form collection.

    L'unico dubbio che ho è la sintassi utilizzata nella variabile testo in particolar modo nn so se è corretto il termine "trim".

    :master:

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    codice:
    <form id="form1" name="form1" method="POST" action="<%=MM_editAction%>" enctype="multipart/form-data">
    ROby

  3. #3
    Utente di HTML.it L'avatar di maspar
    Registrato dal
    Mar 2001
    Messaggi
    276
    Trim è una funzione, non un "termine", serve per eliminare gli spazi iniziali e finali in un stringa.
    Hai apportato la modifica che ti ha segnalato Roby?


    Non discutere mai con un idiota: la gente potrebbe non notare la differenza. (Arthur Bloch)

    Ricchezza di fini, semplicità di mezzi. (Arne Naess)

  4. #4
    Allora dopo varie prove ho constatato che il problema è l'inserimento dati che viene costruito con Dreamweaver.

    Ho provato a fare questa prova creando due pagine.
    Nella prima pagina ho ilmodulo e come premo invia i dati vengono nel db e si viene reinidirzzati a un'altra pagina dove ho lo script per l'invio della mail.

    Vi posto il codice della pagina con il modulo che inserisce i dati nel DB (modulo_prova.asp):
    codice:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    
    <%
    Dim rsUtenti__MMColParam
    rsUtenti__MMColParam = "1"
    If (Session("MM_Username") <> "") Then 
      rsUtenti__MMColParam = Session("MM_Username")
    End If
    %>
    <%
    Dim rsUtenti
    Dim rsUtenti_numRows
    
    Set rsUtenti = Server.CreateObject("ADODB.Recordset")
    rsUtenti.ActiveConnection = MM_moduliAgentiBose_STRING
    rsUtenti.Source = "SELECT * FROM agenti WHERE username = '" + Replace(rsUtenti__MMColParam, "'", "''") + "'"
    rsUtenti.CursorType = 0
    rsUtenti.CursorLocation = 2
    rsUtenti.LockType = 1
    rsUtenti.Open()
    
    rsUtenti_numRows = 0
    %>
    <%
    ' *** Edit Operations: declare variables
    
    Dim MM_editAction
    Dim MM_abortEdit
    Dim MM_editQuery
    Dim MM_editCmd
    
    Dim MM_editConnection
    Dim MM_editTable
    Dim MM_editRedirectUrl
    Dim MM_editColumn
    Dim MM_recordId
    
    Dim MM_fieldsStr
    Dim MM_columnsStr
    Dim MM_fields
    Dim MM_columns
    Dim MM_typeArray
    Dim MM_formVal
    Dim MM_delim
    Dim MM_altVal
    Dim MM_emptyVal
    Dim MM_i
    
    MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
    If (Request.QueryString <> "") Then
      MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
    End If
    
    ' boolean to abort record edit
    MM_abortEdit = false
    
    ' query string to execute
    MM_editQuery = ""
    %>
    <%
    ' *** Insert Record: set variables
    
    If (CStr(Request("MM_insert")) = "form1") Then
    
      MM_editConnection = MM_moduliAgentiBose_STRING
      MM_editTable = "formulario"
      MM_editRedirectUrl = "manda_def.asp"
      MM_fieldsStr  = "ragioneSociale|value|sedeLegale|value|cap|value|citta|value|provincia|value|telefono|value|partitaIva|value|sig|value|urlweb|value|email|value|data|value|id|value"
      MM_columnsStr = "ragioneSociale|',none,''|sedeLegale|',none,''|cap|',none,''|citta|',none,''|provincia|',none,''|telefono|',none,''|partitaIva|',none,''|sig|',none,''|urlweb|',none,''|email|',none,''|data|',none,NULL|id|none,none,NULL"
    
      ' create the MM_fields and MM_columns arrays
      MM_fields = Split(MM_fieldsStr, "|")
      MM_columns = Split(MM_columnsStr, "|")
      
      ' set the form values
      For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
        MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
      Next
    
      ' append the query string to the redirect URL
      If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
        If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
          MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
        Else
          MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
        End If
      End If
    
    End If
    %>
    <%
    ' *** Insert Record: construct a sql insert statement and execute it
    
    Dim MM_tableValues
    Dim MM_dbValues
    
    If (CStr(Request("MM_insert")) <> "") Then
    
      ' create the sql insert statement
      MM_tableValues = ""
      MM_dbValues = ""
      For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
        MM_formVal = MM_fields(MM_i+1)
        MM_typeArray = Split(MM_columns(MM_i+1),",")
        MM_delim = MM_typeArray(0)
        If (MM_delim = "none") Then MM_delim = ""
        MM_altVal = MM_typeArray(1)
        If (MM_altVal = "none") Then MM_altVal = ""
        MM_emptyVal = MM_typeArray(2)
        If (MM_emptyVal = "none") Then MM_emptyVal = ""
        If (MM_formVal = "") Then
          MM_formVal = MM_emptyVal
        Else
          If (MM_altVal <> "") Then
            MM_formVal = MM_altVal
          ElseIf (MM_delim = "'") Then  ' escape quotes
            MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
          Else
            MM_formVal = MM_delim + MM_formVal + MM_delim
          End If
        End If
        If (MM_i <> LBound(MM_fields)) Then
          MM_tableValues = MM_tableValues & ","
          MM_dbValues = MM_dbValues & ","
        End If
        MM_tableValues = MM_tableValues & MM_columns(MM_i)
        MM_dbValues = MM_dbValues & MM_formVal
      Next
      MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
    
      If (Not MM_abortEdit) Then
        ' execute the insert
        Set MM_editCmd = Server.CreateObject("ADODB.Command")
        MM_editCmd.ActiveConnection = MM_editConnection
        MM_editCmd.CommandText = MM_editQuery
        MM_editCmd.Execute
        MM_editCmd.ActiveConnection.Close
    
        If (MM_editRedirectUrl <> "") Then
          Response.Redirect(MM_editRedirectUrl)
        End If
      End If
    
    End If
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Documento senza titolo</title>
    <link href="css/moduli.css" rel="stylesheet" type="text/css" />
    </head>
    
    <body>
    <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td align="center" valign="top"><form action="<%=MM_editAction%>" method="POST" enctype="multipart/form-data" name="form1" id="form1">
    ...
    ...
    ....
    ....
        </form>
        </td>
      </tr>
    </table>
    </body>
    </html>
    <%
    rsUtenti.Close()
    Set rsUtenti = Nothing
    %>
    Questo invece è il codice della pagina che mi consente di inviare la mail con gli allegati (manda_def.asp):
    codice:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <%
    Dim form, subject, allegato1, allegato2, allegato3
    %>
    
    <Html>
    <head>
    <title>Email spedita</title>
    </head>
    <body>
    
    
    
    <%
    Dim oUpload 
    Set oUpload = new cUpload
    oUpload.SetPath "upload\"
    oUpload.Load
    if oUpload.Count=0 then
    	allegato1 = ""
    	allegato2 = ""
    	allegato3 = ""
    Else
    	While Not oUpload.EOF
    		oUpload.Save()
    		Select Case lCase(oUpload.Files("InputName"))
    		Case "file1"
                    allegato1 = oUpload.GetFileName()
    		Case "file2"		
    				allegato2 = oUpload.GetFileName()
    		Case "file3"		
    				allegato3 = oUpload.GetFileName()
    		End Select
    		oUpload.MoveNext
    	Wend
    End if
    
    
    
    call Main()
    
    
    
    Sub Main()
    If Len(oUpload.Form("subject")) = 0 then
    no_sub()
    else 
    manda_posta(form)
    ecco_fatto(nome)
    end if
    Set oUpload=Nothing 
    End sub
    
    
    
    Sub no_sub()
    response.write "<div align='center'>"
    response.write "<table border='0' width='80%' cellspadding='4' cellspacing='4'>" 
    response.write "<tr><td>Non hai inserito un subject</td></tr>"
    response.write "<tr><td>Per favore, torna indiedro e inseriscine uno </td></tr>"
    response.write "<tr><td align='middlè>"
    response.write "<a href=java-script:history.go(-1)>Pagina precedente</a>"
    response.write "</td></tr></table></div>"
    End Sub
    
    
    
    Sub manda_posta(form)
    Dim subject
    Dim objMail, objMailConfig
    subject = oUpload.Form("subject")
    mittente = oUpload.Form("mittente")
    Set objMail = Server.CreateObject("CDO.Message")
    Set objMailConfig = Server.CreateObject ("CDO.Configuration")
    
    ' Proprietà di invio
    with objMailConfig
      ' SMTP mail server
      .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.eurnetcity.net"
      ' SMTP port
      .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
      ' CDO port
      .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      ' Timeout
      .Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
      .Fields.Update
    end with
    
    Set objMail.Configuration = objMailConfig
    
    objMail.From = "r.didonato@infotrading.it"
    objMail.To = oUpload.Form("email")
    objMail.cc = "roberto@robertodidonato.it"
    objMail.Subject = subject
    objMail.TextBody = "Ragione Sociale: " & oUpload.Form("ragioneSociale") & vbcrlf & "Sede Legale: " & oUpload.Form("sedeLegale") & vbcrlf & "CAP: " & oUpload.Form("cap") & vbcrlf & "Città: " & oUpload.Form("citta") & vbcrlf & "Provincia: " & oUpload.Form("provincia") & vbcrlf & "Telefono: " & oUpload.Form("telefono") & vbcrlf & "Partita Iva: " & oUpload.Form("partitaIva") & vbcrlf & "Rappresentata dal Sig.: " & oUpload.Form("sig") & vbcrlf & "Indirizzo web: " & oUpload.Form("urlweb") & vbcrlf & "E-Mail: " & oUpload.Form("email") & vbcrlf & "Data: " & oUpload.Form("data")
    
    If Len(allegato1) <> 0 then
    objMail.AddAttachment Server.MapPath("upload\" & allegato1)
    end if
    If Len(allegato2) <> 0 then
    objMail.AddAttachment Server.MapPath("upload\" & allegato2)
    end if
    If Len(allegato3) <> 0 then
    objMail.AddAttachment Server.MapPath("upload\" & allegato3)
    end if
    objMail.Fields("urn:schemas:httpmail:importance").Value = 0
    objMail.Fields.update() 
    objMail.Send
    Set objMail = Nothing
    end sub
    
    
    
    Sub ecco_fatto(nome)
    response.write "<div align='center'>"
    response.write "<table border='0' width='80%' cellspadding='4' cellspacing='4'>" 
    response.write "<tr><td>Grazie " & subject & " per la mail</td></tr>"
    response.write "<tr><td align='middle'>"
    response.write "<a href=java-script:history.go(-2)>Torna indietro</a>"
    response.write "</td></tr></table></div>"
    End sub
    
    
    
    %>
    </body>
    Tengo a precisare che per ora non ho la ncessità di inserire gli allegati nel Database ma solo i campi testo.

    Il problema in questo caso è che se io inserisco enctype="multipart/form-data" il modulo invia correttamente la mail ma non i dati nel DB.

    Se levo questa opzione i dati mi vengono correttamente inseriti nel DB ma mi da errore nella pagina successiva.

    Ho visto negli esempi dell'upload id Baol quello che mi permette di caricare i dati nel DB.
    Solo che questo esempio non incorpora l'invio della mail.

    Come per prima potete darmi cortesemente uno spunto da cui partire?

    Grazie in anticipo


  5. #5
    Mi sono messo l'anima in pace e secondo me la via migliore è più pratica è quello di evitare di inserire i record con dreamweaver e di usare gli script di Baol sia per quanto riguarda l'invio delle mail che l'upload sul database.

    Ora però ho da provi una domanda:

    La sequenza giusta per effettuare tutta l'operazione è la seguente:

    1) Caricamento file sul server;
    2) Salavataggio di campi testo e file (A questo punto salvo anche gli allegati visto che lo script di Baol lo esegue)
    3) Invio della mail con gli allegati.

    E' giusta come sequenza?

    Se si credo che devo cercare di accorpare i due script in uno solo cosi da ottenere il salavataggio dei dai e l'invio della mail.

  6. #6
    Allora, ho lavorato sugli script ed il risultato che ho ottenutp è questo:

    codice:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <%
    Dim form, subject, allegato1, allegato2, allegato3
    %>
    
    <Html>
    <head>
    <title>Email spedita</title>
    </head>
    <body>
    
    
    
    <%
    Dim oUpload 
    Set oUpload = new cUpload
    oUpload.SetPath "upload\"
    oUpload.Load
    if oUpload.Count=0 then
    	allegato1 = ""
    	allegato2 = ""
    	allegato3 = ""
    Else
    	While Not oUpload.EOF
    		oUpload.Save()
    		Select Case lCase(oUpload.Files("InputName"))
    		Case "file1"
                    allegato1 = oUpload.GetFileName()
    		Case "file2"		
    				allegato2 = oUpload.GetFileName()
    		Case "file3"		
    				allegato3 = oUpload.GetFileName()
    		End Select
    		oUpload.MoveNext
    	Wend
    End if
    
    'Qui inserisco lo script per inserire i dati nel database
    With oUpload
    .SetDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath("database/agenti.mdb"),"SELECT Top 1 * FROM news"
    .EnabledAspUpload	= False
    .EnabledImageSize	= False
    .EnabledLog 		 = False
    .AutoRename 		 = True
    .Overwrite			 = False
    .SetPath "upload\"
    .Load
    .MoveFirst
    if .EOF then
    	NumFiles = .Count()
    	Response.write "0 Files caricati su " & NumFiles &" : controlla le dimensioni e il tipo di file."
    else
    	.Database.Open()
    	While Not .EOF
    			.Save
    			response.Write "il file " & .GetFileName &" è stato salvato 
    "
    			'Inserimento dei valori
    			.Database.Fields("ragioneSociale") = .Form("ragioneSociale")
    			.Database.Fields("sedeLegale") = .Form("sedeLegale")
    			.Database.Fields("cap") = .Form("cap")
    			.Database.Fields("citta") = .Form("provincia")
    			.Database.Fields("telefono") = .Form("telefono")
    			.Database.Fields("partitaIva") = .Form("partitaIva")
    			.Database.Fields("sig") = .Form("sig")
    			.Database.Fields("urlWeb") = .Form("urlWeb")
    			.Database.Fields("email") = .Form("email")
    			.Database.Fields("data") = .Form("data")
    			.Database.Fields("file1") = .GetCompletePathFile
    			.Database.Fields("file2") = .GetCompletePathFile
    			.Database.Fields("file3") = .GetCompletePathFile
    			'Inserimento
    			.Database.AddNew()
    	.MoveNext
    	Wend
    end if
    End With
    ' Fine inserimento dati nel database
    
    call Main()
    
    
    
    Sub Main()
    If Len(oUpload.Form("subject")) = 0 then
    no_sub()
    else 
    manda_posta(form)
    ecco_fatto(nome)
    end if
    Set oUpload=Nothing 
    End sub
    
    
    
    Sub no_sub()
    response.write "<div align='center'>"
    response.write "<table border='0' width='80%' cellspadding='4' cellspacing='4'>" 
    response.write "<tr><td>Non hai inserito un subject</td></tr>"
    response.write "<tr><td>Per favore, torna indiedro e inseriscine uno </td></tr>"
    response.write "<tr><td align='middlè>"
    response.write "<a href=java-script:history.go(-1)>Pagina precedente</a>"
    response.write "</td></tr></table></div>"
    End Sub
    
    
    
    Sub manda_posta(form)
    Dim subject
    Dim objMail, objMailConfig
    subject = oUpload.Form("subject")
    mittente = oUpload.Form("mittente")
    Set objMail = Server.CreateObject("CDO.Message")
    Set objMailConfig = Server.CreateObject ("CDO.Configuration")
    
    ' Proprietà di invio
    with objMailConfig
      ' SMTP mail server
      .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.eurnetcity.net"
      ' SMTP port
      .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
      ' CDO port
      .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      ' Timeout
      .Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
      .Fields.Update
    end with
    
    Set objMail.Configuration = objMailConfig
    
    objMail.From = "r.didonato@infotrading.it"
    objMail.To = oUpload.Form("email")
    objMail.cc = "roberto@robertodidonato.it"
    objMail.Subject = subject
    objMail.TextBody = "Ragione Sociale: " & oUpload.Form("ragioneSociale") & vbcrlf & "Sede Legale: " & oUpload.Form("sedeLegale") & vbcrlf & "CAP: " & oUpload.Form("cap") & vbcrlf & "Città: " & oUpload.Form("citta") & vbcrlf & "Provincia: " & oUpload.Form("provincia") & vbcrlf & "Telefono: " & oUpload.Form("telefono") & vbcrlf & "Partita Iva: " & oUpload.Form("partitaIva") & vbcrlf & "Rappresentata dal Sig.: " & oUpload.Form("sig") & vbcrlf & "Indirizzo web: " & oUpload.Form("urlweb") & vbcrlf & "E-Mail: " & oUpload.Form("email") & vbcrlf & "Data: " & oUpload.Form("data")
    
    If Len(allegato1) <> 0 then
    objMail.AddAttachment Server.MapPath("upload\" & allegato1)
    end if
    If Len(allegato2) <> 0 then
    objMail.AddAttachment Server.MapPath("upload\" & allegato2)
    end if
    If Len(allegato3) <> 0 then
    objMail.AddAttachment Server.MapPath("upload\" & allegato3)
    end if
    objMail.Fields("urn:schemas:httpmail:importance").Value = 0
    objMail.Fields.update() 
    objMail.Send
    Set objMail = Nothing
    end sub
    
    
    
    Sub ecco_fatto(nome)
    response.write "<div align='center'>"
    response.write "<table border='0' width='80%' cellspadding='4' cellspacing='4'>" 
    response.write "<tr><td>Grazie " & subject & " per la mail</td></tr>"
    response.write "<tr><td align='middle'>"
    response.write "<a href=java-script:history.go(-2)>Torna indietro</a>"
    response.write "</td></tr></table></div>"
    End sub
    
    
    
    %>
    </body>
    </html>
    La pagina del form è la seguente:
    codice:
    <body>
    <form action="manda_def.asp" method="post" enctype="multipart/form-data">
    .
    .
    .
    .
    .
    .
               <td colspan="3" align="left" class="moduli"><input name="ragioneSociale" type="text" class="moduli" id="ragioneSociale" size="40" /></td>
              </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td colspan="3" align="left" class="moduli">Sede Legale via/Piazza</td>
              </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td colspan="3" align="left" class="moduli"><input name="sedeLegale" type="text" class="moduli" id="sedeLegale" size="40" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td colspan="3" class="moduli"><table width="500" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="94" align="left">CAP</td>
                  <td width="287" align="left">Citt&agrave;</td>
                  <td width="119" align="left">Provincia</td>
                </tr>
                <tr>
                  <td colspan="3">[img]immagini/null.gif[/img]</td>
                  </tr>
                <tr>
                  <td align="left"><label>
                    <input name="cap" type="text" class="moduli" id="cap" size="10" />
                  </label></td>
                  <td align="left"><input name="citta" type="text" class="moduli" id="citta" size="42" /></td>
                  <td align="left"><input name="provincia" type="text" class="moduli" id="provincia" size="5" /></td>
                </tr>
                <tr>
                  <td colspan="3">[img]immagini/null.gif[/img]</td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td colspan="3" align="left" class="moduli">Telefono:</td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td colspan="3" align="left" class="moduli"><input name="telefono" type="text" class="moduli" id="telefono" size="40" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td colspan="3" class="moduli"><table width="500" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="241" align="left">Partita IVA / Codice Fiscale </td>
                  <td width="259" align="left">Rappresentata dal Sig. </td>
                  </tr>
                <tr>
                  <td colspan="2">[img]immagini/null.gif[/img]</td>
                </tr>
                <tr>
                  <td align="left"><label>
                    <input name="partitaIva" type="text" class="moduli" id="partitaIva" size="35" />
                  </label></td>
                  <td align="left"><input name="sig" type="text" class="moduli" id="sig" size="42" /></td>
                  </tr>
                <tr>
                  <td colspan="2">[img]immagini/null.gif[/img]</td>
                </tr>
              </table></td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli">URL del sito web (Se esistente) </td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli"><input name="urlweb" type="text" class="moduli" id="urlweb" size="42" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli">Indirizzo e-mail </td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli"><input name="email" type="text" class="moduli" id="email" size="42" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli">Data:</td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli"><input name="data" type="text" class="moduli" id="data" size="20" /> 
                Formato: gg/mm/aaaa </td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            
            <tr>
              <td colspan="3" align="center" class="moduli">Foto del negozio </td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
    
            <tr>
              <td width="100" align="right" class="moduli">Foto 1:</td>
              <td width="20" class="moduli"></td>
              <td width="380" class="moduli"><input name="file1" type="file" class="moduli" size="35" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td align="right" class="moduli">Foto 2:</td>
              <td class="moduli"></td>
              <td class="moduli"><input name="file2" type="file" class="moduli" size="35" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td align="right" class="moduli">Foto 3:</td>
              <td class="moduli"></td>
              <td class="moduli"><input name="file3" type="file" class="moduli" size="35" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td class="moduli"></td>
              <td class="moduli"></td>
              <td class="moduli"><label>
                <input name="Submit" type="reset" class="moduli" value="Ripristina" />
              
              <input name="Submit2" type="submit" class="moduli" value="Invia" />
              </label></td>
            </tr>
          </table>
    </form>
    Quando premo invio nel form mi va alla pagina di caricamento dati nel Db e invio mail solo che non mi dice nulla e soprattutto non invia la mail, ne salva i dati nel DB.

    Potete indirizzarmi verso l'errore?


  7. #7
    Allora ho provato a modificare lo script in questo modo:

    codice:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <%
    Dim form, subject, allegato1, allegato2, allegato3
    %>
    
    <Html>
    <head>
    <title>Email spedita</title>
    </head>
    <body>
    
    
    
    <%
    Dim oUpload 
    Set oUpload = new cUpload
    oUpload.SetPath "upload\"
    oUpload.Load
    if oUpload.Count=0 then
    	allegato1 = ""
    	allegato2 = ""
    	allegato3 = ""
    Else
    	While Not oUpload.EOF
    		oUpload.Save()
    		Select Case lCase(oUpload.Files("InputName"))
    		Case "file1"
                    allegato1 = oUpload.GetFileName()
    		Case "file2"		
    				allegato2 = oUpload.GetFileName()
    		Case "file3"		
    				allegato3 = oUpload.GetFileName()
    		End Select
    		oUpload.MoveNext
    	Wend
    End if
    
    'Qui inserisco lo script per inserire i dati nel database
    oUpload.SetDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath("database/agenti.mdb"),"SELECT Top 1 * FROM news"
    oUpload.EnabledAspUpload	= False
    oUpload.EnabledImageSize	= False
    oUpload.EnabledLog 		 = False
    oUpload.AutoRename 		 = True
    oUpload.Overwrite			 = False
    oUpload.SetPath "upload\"
    oUpload.Load
    oUpload.MoveFirst
    if oUpload.EOF then
    	NumFiles = oUpload.Count()
    	Response.write "0 Files caricati su " & NumFiles &" : controlla le dimensioni e il tipo di file."
    else
    	oUpload.Database.Open()
    	While Not oUpload.EOF
    			oUpload.Save
    			response.Write "il file " & oUpload.GetFileName &" è stato salvato 
    "
    			'Inserimento dei valori
    			oUpload.Database.Fields("ragioneSociale") = oUpload.Form("ragioneSociale")
    			oUpload.Database.Fields("sedeLegale") = oUpload.Form("sedeLegale")
    			oUpload.Database.Fields("cap") = oUpload.Form("cap")
    			oUpload.Database.Fields("citta") = oUpload.Form("provincia")
    			oUpload.Database.Fields("telefono") = oUpload.Form("telefono")
    			oUpload.Database.Fields("partitaIva") = oUpload.Form("partitaIva")
    			oUpload.Database.Fields("sig") = oUpload.Form("sig")
    			oUpload.Database.Fields("urlWeb") = oUpload.Form("urlWeb")
    			oUpload.Database.Fields("email") = oUpload.Form("email")
    			oUpload.Database.Fields("data") = oUpload.Form("data")
    			oUpload.Database.Fields("file1") = oUpload.GetCompletePathFile
    			oUpload.Database.Fields("file2") = oUpload.GetCompletePathFile
    			oUpload.Database.Fields("file3") = oUpload.GetCompletePathFile
    			'Inserimento
    			oUpload.Database.AddNew()
    	oUpload.MoveNext
    	Wend
    end if
    ' Fine inserimento dati nel database
    
    call Main()
    
    
    
    Sub Main()
    If Len(oUpload.Form("subject")) = 0 then
    no_sub()
    else 
    manda_posta(form)
    ecco_fatto(nome)
    end if
    Set oUpload=Nothing 
    End sub
    
    
    
    Sub no_sub()
    response.write "<div align='center'>"
    response.write "<table border='0' width='80%' cellspadding='4' cellspacing='4'>" 
    response.write "<tr><td>Non hai inserito un subject</td></tr>"
    response.write "<tr><td>Per favore, torna indiedro e inseriscine uno </td></tr>"
    response.write "<tr><td align='middlè>"
    response.write "<a href=java-script:history.go(-1)>Pagina precedente</a>"
    response.write "</td></tr></table></div>"
    End Sub
    
    
    
    Sub manda_posta(form)
    Dim subject
    Dim objMail, objMailConfig
    subject = oUpload.Form("subject")
    mittente = oUpload.Form("mittente")
    Set objMail = Server.CreateObject("CDO.Message")
    Set objMailConfig = Server.CreateObject ("CDO.Configuration")
    
    ' Proprietà di invio
    with objMailConfig
      ' SMTP mail server
      .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.eurnetcity.net"
      ' SMTP port
      .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
      ' CDO port
      .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      ' Timeout
      .Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
      .Fields.Update
    end with
    
    Set objMail.Configuration = objMailConfig
    
    objMail.From = "r.didonato@infotrading.it"
    objMail.To = oUpload.Form("email")
    objMail.cc = "roberto@robertodidonato.it"
    objMail.Subject = subject
    objMail.TextBody = "Ragione Sociale: " & oUpload.Form("ragioneSociale") & vbcrlf & "Sede Legale: " & oUpload.Form("sedeLegale") & vbcrlf & "CAP: " & oUpload.Form("cap") & vbcrlf & "Città: " & oUpload.Form("citta") & vbcrlf & "Provincia: " & oUpload.Form("provincia") & vbcrlf & "Telefono: " & oUpload.Form("telefono") & vbcrlf & "Partita Iva: " & oUpload.Form("partitaIva") & vbcrlf & "Rappresentata dal Sig.: " & oUpload.Form("sig") & vbcrlf & "Indirizzo web: " & oUpload.Form("urlweb") & vbcrlf & "E-Mail: " & oUpload.Form("email") & vbcrlf & "Data: " & oUpload.Form("data")
    
    If Len(allegato1) <> 0 then
    objMail.AddAttachment Server.MapPath("upload\" & allegato1)
    end if
    If Len(allegato2) <> 0 then
    objMail.AddAttachment Server.MapPath("upload\" & allegato2)
    end if
    If Len(allegato3) <> 0 then
    objMail.AddAttachment Server.MapPath("upload\" & allegato3)
    end if
    objMail.Fields("urn:schemas:httpmail:importance").Value = 0
    objMail.Fields.update() 
    objMail.Send
    Set objMail = Nothing
    end sub
    
    
    
    Sub ecco_fatto(nome)
    response.write "<div align='center'>"
    response.write "<table border='0' width='80%' cellspadding='4' cellspacing='4'>" 
    response.write "<tr><td>Grazie " & subject & " per la mail</td></tr>"
    response.write "<tr><td align='middle'>"
    response.write "<a href=java-script:history.go(-2)>Torna indietro</a>"
    response.write "</td></tr></table></div>"
    End sub
    
    
    
    %>
    </body>
    </html>
    Però mi restituisce il seguente errore:

    ADODB.Stream error '800a0bb9'
    Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
    /testModuli/upload.asp, line 291

    Alla riga 291 del file upload.asp ho il seguente codice:

    Stream.Write Request.BinaryRead(bTr)

  8. #8
    Allora girovagando per il forum ho provato questa soluzione:

    codice:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <%
    Dim form, subject, FileName_file1, FileName_file2, FileName_file3
    %>
    <%
    	If Request.QueryString("Save")="1" then
    		Dim oUpload
    		Set oUpload = new cUpload
    		oUpload.AutoRename = True
    		oUpload.Overwrite = False
    		oUpload.SetPath "upload" 'Impostazione del percorso
    		oUpload.Load
    		While Not oUpload.EOF
    			oUpload.Save()
    			Select Case lCase(oUpload.Files("InputName"))
    				Case "file1"
    					FileName_file1 = oUpload.GetFileName()
    				Case "file2"
    					FileName_file2 = oUpload.GetFileName()
    				Case "file3"
    					FileName_file3 = oUpload.GetFileName()	
    			End Select
    			oUpload.MoveNext
    		Wend			
    		Set Conn = Server.CreateObject("ADODB.Connection")
    		Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("database/agenti.mdb")
    		Set Rs=server.CreateObject("ADODB.Recordset")
    		Rs.Open "news",Conn,3,3
    		Rs.AddNew
    		Rs("subject")           = oUpload.Form("subject")
    		Rs("ragioneSociale")	= oUpload.Form("ragioneSociale")
    		Rs("sedeLegale")		= oUpload.Form("sedeLegale")
    		Rs("cap")		        = oUpload.Form("cap")
    		Rs("citta")		        = oUpload.Form("citta")
    		Rs("provincia")		    = oUpload.Form("provincia")
    		Rs("telefono")		    = oUpload.Form("telefono")
    		Rs("partitaIva")		= oUpload.Form("partitaIva")
    		Rs("sig")		        = oUpload.Form("sig")
    		Rs("urlweb")		    = oUpload.Form("urlweb")
    		Rs("email")		        = oUpload.Form("email")
    		Rs("data")		        = oUpload.Form("data")
    		Rs("file1")	            = FileName_file1
    		Rs("file2")	            = FileName_file2
    		Rs("file3")	            = FileName_file3 
    		Rs.update
    		Rs.Close
    		Conn.Close
    		Set Rs = Nothing
    		Set Conn=Nothing				
    		Set oUpload = Nothing
    
    Sub Main()
    If Len(oUpload.Form("subject")) = 0 then
    no_sub()
    else 
    manda_posta(form)
    ecco_fatto(nome)
    end if
    Set oUpload=Nothing 
    End sub
    
    
    
    Sub no_sub()
    response.write "<div align='center'>"
    response.write "<table border='0' width='80%' cellspadding='4' cellspacing='4'>" 
    response.write "<tr><td>Non hai inserito un subject</td></tr>"
    response.write "<tr><td>Per favore, torna indiedro e inseriscine uno </td></tr>"
    response.write "<tr><td align='middlè>"
    response.write "<a href=java-script:history.go(-1)>Pagina precedente</a>"
    response.write "</td></tr></table></div>"
    End Sub
    
    
    
    Sub manda_posta(form)
    Dim subject
    Dim objMail, objMailConfig
    subject = oUpload.Form("subject")
    mittente = oUpload.Form("mittente")
    Set objMail = Server.CreateObject("CDO.Message")
    Set objMailConfig = Server.CreateObject ("CDO.Configuration")
    
    ' Proprietà di invio
    with objMailConfig
      ' SMTP mail server
      .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.eurnetcity.net"
      ' SMTP port
      .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
      ' CDO port
      .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      ' Timeout
      .Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
      .Fields.Update
    end with
    
    Set objMail.Configuration = objMailConfig
    
    objMail.From = "mail@mail.it"
    objMail.To = oUpload.Form("email")
    objMail.cc = "mail@mail.it"
    objMail.Subject = subject
    objMail.TextBody = "Ragione Sociale: " & oUpload.Form("ragioneSociale") & vbcrlf & "Sede Legale: " & oUpload.Form("sedeLegale") & vbcrlf & "CAP: " & oUpload.Form("cap") & vbcrlf & "Città: " & oUpload.Form("citta") & vbcrlf & "Provincia: " & oUpload.Form("provincia") & vbcrlf & "Telefono: " & oUpload.Form("telefono") & vbcrlf & "Partita Iva: " & oUpload.Form("partitaIva") & vbcrlf & "Rappresentata dal Sig.: " & oUpload.Form("sig") & vbcrlf & "Indirizzo web: " & oUpload.Form("urlweb") & vbcrlf & "E-Mail: " & oUpload.Form("email") & vbcrlf & "Data: " & oUpload.Form("data")
    
    If Len(allegato1) <> 0 then
    objMail.AddAttachment Server.MapPath("upload\" & FileName_file1)
    end if
    If Len(allegato2) <> 0 then
    objMail.AddAttachment Server.MapPath("upload\" & FileName_file2)
    end if
    If Len(allegato3) <> 0 then
    objMail.AddAttachment Server.MapPath("upload\" & FileName_file3)
    end if
    objMail.Fields("urn:schemas:httpmail:importance").Value = 0
    objMail.Fields.update() 
    objMail.Send
    Set objMail = Nothing
    end sub
    
    
    
    Sub ecco_fatto(nome)
    response.write "<div align='center'>"
    response.write "<table border='0' width='80%' cellspadding='4' cellspacing='4'>" 
    response.write "<tr><td>Grazie " & subject & " per la mail</td></tr>"
    response.write "<tr><td align='middle'>"
    response.write "<a href=java-script:history.go(-2)>Torna indietro</a>"
    response.write "</td></tr></table></div>"
    End sub
    End if
    
    
    
    %>
    <form name="form1" method="post" enctype="multipart/form-data" action="?save=1">
          <table width="500" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td colspan="3" align="left" class="moduli"></td>
            </tr>
            <tr>
              <td colspan="3" align="center"><span class="moduli">[img]immagini/null.gif[/img]</span></td>
            </tr>
            <tr>
              <td colspan="3" align="center" class="titoli">Modulo richiesta nuovo punto vendita Bose </td>
            </tr>
            <tr>
              <td colspan="3"><span class="moduli">[img]immagini/null.gif[/img]
                <input name="subject" type="hidden" id="subject" value="Modulo richiesta nuovo punto vendita Bose" />
              </span></td>
            </tr>
            <tr>
              <td colspan="3" align="left" class="moduli">Ragione Sociale
                <label></label></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td colspan="3" align="left" class="moduli"><input name="ragioneSociale" type="text" class="moduli" id="ragioneSociale" size="40" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td colspan="3" align="left" class="moduli">Sede Legale via/Piazza</td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td colspan="3" align="left" class="moduli"><input name="sedeLegale" type="text" class="moduli" id="sedeLegale" size="40" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td colspan="3" class="moduli"><table width="500" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="94" align="left">CAP</td>
                  <td width="287" align="left">Citt&agrave;</td>
                  <td width="119" align="left">Provincia</td>
                </tr>
                <tr>
                  <td colspan="3">[img]immagini/null.gif[/img]</td>
                </tr>
                <tr>
                  <td align="left"><label>
                    <input name="cap" type="text" class="moduli" id="cap" size="10" />
                  </label></td>
                  <td align="left"><input name="citta" type="text" class="moduli" id="citta" size="42" /></td>
                  <td align="left"><input name="provincia" type="text" class="moduli" id="provincia" size="5" /></td>
                </tr>
                <tr>
                  <td colspan="3">[img]immagini/null.gif[/img]</td>
                </tr>
              </table></td>
            </tr>
            <tr>
              <td colspan="3" align="left" class="moduli">Telefono:</td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td colspan="3" align="left" class="moduli"><input name="telefono" type="text" class="moduli" id="telefono" size="40" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td colspan="3" class="moduli"><table width="500" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="241" align="left">Partita IVA / Codice Fiscale </td>
                  <td width="259" align="left">Rappresentata dal Sig. </td>
                </tr>
                <tr>
                  <td colspan="2">[img]immagini/null.gif[/img]</td>
                </tr>
                <tr>
                  <td align="left"><label>
                    <input name="partitaIva" type="text" class="moduli" id="partitaIva" size="35" />
                  </label></td>
                  <td align="left"><input name="sig" type="text" class="moduli" id="sig" size="42" /></td>
                </tr>
                <tr>
                  <td colspan="2">[img]immagini/null.gif[/img]</td>
                </tr>
              </table></td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli">URL del sito web (Se esistente) </td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli"><input name="urlweb" type="text" class="moduli" id="urlweb" size="42" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli">Indirizzo e-mail </td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli"><input name="email" type="text" class="moduli" id="email" size="42" /></td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli">Data:</td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr align="left">
              <td colspan="3" class="moduli"><input name="data" type="text" class="moduli" id="data" size="20" /> 
                Formato: gg/mm/aaaa </td>
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            
            <tr>
    .
    .
    .
    .
    
            </tr>
            <tr>
              <td colspan="3" class="moduli">[img]immagini/null.gif[/img]</td>
            </tr>
            <tr>
              <td class="moduli"></td>
              <td class="moduli"></td>
              <td class="moduli"><label>
                <input name="Submit" type="reset" class="moduli" value="Ripristina" />
              
              <input name="Submit2" type="submit" class="moduli" value="Invia" />
              </label></td>
            </tr>
          </table>
    </form>
    I dati mi vengono caricati correttamente nel database ma la mail non viene spedita.

    Tengo a precisare che testati singolarmente, lo script peril caricamento sul database e lo script per l'invio della mail funzionano correttamente.

    Potete aiutarmi cortesemente


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 © 2026 vBulletin Solutions, Inc. All rights reserved.