%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% Dim strMessage Dim strNome Dim strCognome Dim strCommento Dim strFile, strFilePath Dim objFso Dim objFile Dim objMail ' Dettagli per l'invio dell'email Const strDestinatario = "gabs@libero.it" Const strMittente = "mittente@email.it" Const strOggetto = "Email inviata tramite form" ' Imposta a true per rimuovere il file dopo l'invio Const blnDelete = false ' Controlla l'invio della form if Request.Querystring("send") = 1 AND Len(Request.Form("submit")) > 0 then ' Richiama i dati dalla form strNome = Request.Form("nome") strCognome = Request.Form("cognome") strDitta = Request.Form("ditta") strInd = Request.Form("ind") strCity = Request.Form("city") strProv = Request.Form("prov") strCap = Request.Form("cap") strNaz = Request.Form("naz") strEmail = Request.Form("email") strTel = Request.Form("tel") strCommento = Request.Form("commento") ' Crea il nome strFile = "emailatt-" &_ Year(Now()) & Month(Now()) & Day(Now()) & "-" & Clng(Timer()) & ".txt" ' Ricava il percorso del file sul server strFilePath = Server.MapPath(strFile) ' Crea il file sul server Set objFso = Server.CreateObject("Scripting.FileSystemObject") Set objFile = objFso.CreateTextFile(strFilePath, true) objFile.WriteLine("Email inviata il " & Date() & " alle " & Time()) objFile.WriteLine("IP: " & Request.ServerVariables("REMOTE_ADDR")) objFile.WriteLine("Client: " & Request.ServerVariables("HTTP_USER_AGENT")) objFile.WriteLine("Nominativo: " & strNome & " " & strCognome) objFile.WriteBlankLines(1) objFile.Writeline(strCommento) objFile.Close Set objFile = Nothing Set objFso = Nothing ' Crea l'oggetto CDONTS Set objMail = Server.CreateObject("CDONTS.NewMail") with objMail ' Mittente .From = strMittente ' Destinatario .To = strDestinatario ' Oggetto .Subject = strOggetto ' Corpo dell'email .Body = "Allegato contenuto email." ' Impostazioni .BodyFormat = 1 ' testo .MailFormat = 1 ' testo .Importance = 1 ' normale ' Allegato .AttachFile strFilePath ' Invia l'email .Send end with Set objMail = Nothing ' Elimina il file dal server se richiesto if blnDelete then Set objFso = Server.CreateObject("Scripting.FileSystemObject") ' Controlla la presenza del file ed elimina if objFso.fileExists(strFilePath) then objFso.deleteFile(strFilePath) end if Set objFso = Nothing end if ' codice per la creazione del file ' scrittura dei contenuti ' ed invio email ' messaggio di conferma strMessage = "
L'email è stata inviata correttamente.
"
strMessage = strMessage & "Il contenuto della form è stato allegato all'email.
|
| ||||||||||||
| ||||||||||||
| ||||||||||||
|
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||