Buongiorno a tutti, e lo spero vivamente poichè per me lo è.
Ieri sera mi ero avvicinato molto alla soluzione del problema e stamani a mente lucida l'ho FINALMENTE risolto. Di seguito la soluzione se a qualcuno interessa.
codice:
<%@LANGUAGE="VBSCRIPT"%>
<%' Controllo se l'utente si è logato
If Session("status") <> "login" Then
response.redirect "software.asp"
Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.CacheControl = "no-cache"
End If
%>
<!--#include file="aspZip.class.asp" -->
<HTML>
<HEAD>
<TITLE>TEAM-GEST</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stile.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function chiudi() {
self.close();
}
</script>
</HEAD>
<%
Dim fso, folder, files, File
Set fso = CreateObject("Scripting.FileSystemObject")
dir = "/public/Ricevute/"
bckdir = dir & "Ricevute al "&Replace(FormatDateTime(Date(),2),"/","-")
If not fso.FolderExists(Server.MapPath(bckdir)) Then
fso.CreateFolder(Server.MapPath(bckdir))
Set folder = fso.getfolder(Server.MapPath(dir))
' Recupero i files contenuti nella cartella
Set files = folder.files
' Ciclo i files
For Each file in files
fso.CopyFile file.path, Server.MapPath(bckdir & "/" & file.name)
Next
else
Set folder = fso.getfolder(Server.MapPath(dir))
' Recupero i files contenuti nella cartella
Set files = folder.files
' Ciclo i files
For Each file in files
fso.CopyFile file.path, Server.MapPath(bckdir & "/" & file.name)
Next
End If
filepath = "/public/Ricevute/Zip/"&Replace(FormatDateTime(Date(),2),"/","-")&".zip"
folderToZip=Server.MapPath(bckdir)
set zip = new aspZip
zip.OpenArquieve(filepath)
zip.Add(folderToZip)
zip.CloseArquieve()
set zip = nothing
' INIZIO CODICE PER INVIO MAIL
Dim Mail_STRING
Mail_STRING = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath(""& session("MM_Percorso") &"")
MailDestinatario = "xxxxxx@gmail.com"
OggettoMail = "Lista quote saldate"
Dim objMail, objConfig
Set objMail = Server.CreateObject("CDO.Message")
Set objConfig = Server.CreateObject ("CDO.Configuration")
With objConfig
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.aruba.it"
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0
.Fields.Update
End With
FileZipAttach = "/public/Ricevute/Zip/"&Replace(FormatDateTime(Date(),2),"/","-")&".zip"
PercorsoZip = Server.MapPath(FileZipAttach)
Set objMail.Configuration = objConfig
objMail.From = "yyyyyyyy@gggggg.it" ' INDIRIZZO DAL QUALE SI RICEVE LA MAIL
objMail.To = MailDestinatario
objMail.Sender = "yyyyyyyy@gggggg.it" ' INDIRIZZO CREATO SU ARUBA
objMail.Subject = OggettoMail
objMail.AddAttachment(PercorsoZip)
objMail.HTMLBody = "Con la presente per inviarvi il reseconto delle quote di iscrizione."
objMail.Send()
Set objMail = Nothing
%>
<script language="javascript">
var r= window.alert("MAIL INVIATA CON SUCCESSO!");
</script>
<%'end if
' FINE CODICE PER INVIO MAIL
%>
<body topmargin="3" bottommargin="3" bgcolor="#7A8996">
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td></td>
<td align="center"><a href="javascript: chiudi()"><img src="/images/mini/logout.png" width="30" height="30" alt="CHIUDI"></a></td>
<td> </td>
</tr>
</table>
</body>
</html>
Grazie a tutti per la collaborazione