Sometimes there are thing that we do not consider or some holds on the data.cfm that create files on the mail directory.. at least this is the theory.. We made a clean up file based on Howie's clean up code that deletes from 20 to 500 files every 120 minutes.. we set this on the cf admin scheduler.. we also added some other clean up file that expires free users that have not loged in in X time ..
Here is the file we ended up with out the things FusionMail does not have.. If there is an error running this file just take a look at the code and remove the thing that are not made for infusion I try to clean all things that do not correspond to the free version but not sure if they are all, I have not seen the infusion code in some time from now.. by other way I would like to.. I have not seen the new version .. I am sure it must be pretty good :)
Hope this helps
PD
Have in mind to add a good time out since this will take from 2 to 5 min to run depending on the number of files.. on one more thing.. the clean up file sends you report to your email saying how many files where proceed and how many deleted plus the exec time..
At 10:17 a.m. 30/08/00 +0800, you wrote:
I've just noticed that there are a couple of large (old) messages
sitting in my Mail directory but when I went into FusionMail to see what
they were I couldn't find them. I then checked in the database to see
who they belonged too (most of my clients are using their own mail
clients) but I couldn't find them in there either. Does this mean that a
message has been deleted from FusionMail but the file for the message
itself has not been deleted? Has anybody else found this? And has anyone
written a 'cleanup.cfm' to fix it (if it is a problem)?
Regards and Thanks
Brett Payne-Rhodes
B)
========================================================================
This list server is Powered by iMS
'The Swiss Army Knife of Mail Servers'
--------------------------------------
To leave this list please complete the form at
http://www.CoolFusion.com/iMS.htm
List archives: http://www.mail-archive.com/infusion-email%40eoscape.com/
========================================================================
<!--- set admin email with the report of the action --->
<cfset adminmail="[EMAIL PROTECTED]">
<!--- set to "YES" if you want to have an email with the action report --->
<cfset sendmail="yes">
<cfset makedate1=#dateformat(Now())#>
<cfset maketime1=#timeformat(Now())#>
<cfset ConfiguredMailDirectory="f:\IMS\MAIL">
<!--- get list of raw mail files --->
<cfdirectory
action="list"
directory="#ConfiguredMailDirectory#"
name="maillist">
<cfset counter=0>
<cfloop query="maillist">
<cfquery
name="MailDBExists"
datasource="iMS">
select MessageID from Mail
where FileName='#ConfiguredMailDirectory#\#name#'
</cfquery>
<cfoutput>
<cfset fullpath=ConfiguredMailDirectory&"\"&name>
<cfif MailDBExists.RecordCount is 0>
<cfif fileexists(fullpath)>
<cffile
action="delete"
file="#fullpath#">
<cfset counter=counter+1>
</cfif>
</cfif>
</cfoutput>
</cfloop>
<cfquery name="GetMail" datasource="iMS" dbtype="ODBC">
SELECT MessageID, FileName
FROM dbo.Mail
</cfquery>
<cfloop query="getmail">
<cfif fileexists(getmail.filename) is "no">
<cfquery name="DeleteMail" datasource="iMS" dbtype="ODBC">
DELETE FROM MAIL
WHERE MessageID = '#getmail.MessageID#'
</cfquery>
</cfif>
</cfloop>
<cfset makedate2=#dateformat(Now())#>
<cfset maketime2=#timeformat(Now())#>
<!--- Deletes all mail containing X in subject --->
<cfquery name="GetMail" datasource="iMS" dbtype="ODBC">
SELECT
MessageID,
MailFrom,
ReplyTo,
FileName,
subject
FROM
dbo.Mail
</cfquery>
<cfloop query="GetMail">
<cfif #GetMail.MailFrom# is "inFusion Mail Server">
<cfif FileExists("#GetMail.FileName#")>
<cffile action="DELETE" file="#GetMail.FileName#">
</cfif>
<cfquery name="Del" datasource="iMS" dbtype="ODBC">
DELETE FROM dbo.Mail WHERE
MessageID = #GetMail.MessageID#
</cfquery>
</cfif>
</cfloop>
<!--- delete mails from trash cans --->
<cfquery name="GetTrash" datasource="iMS" dbtype="ODBC">
SELECT
MessageID,
Folder,
FileName
FROM
dbo.Mail
WHERE Folder = 2
</cfquery>
<cfset counter1=0>
<cfloop query="GetTrash">
<cfif FileExists("#GetTrash.FileName#")>
<cffile action="DELETE" file="#GetTrash.FileName#">
</cfif>
<cfquery name="Del" datasource="iMS" dbtype="ODBC">
DELETE FROM dbo.Mail WHERE
MessageID = #GetTrash.MessageID#
</cfquery>
<cfset counter1=counter1+1>
</cfloop>
<pre>
<cfoutput>
Reporte de mantenimiento:
Inicio: #maketime1#, #makedate1#
Fin: #maketime2#, #makedate2#
Archivos procesados: #maillist.recordcount#
Archivos excedentes eliminados: #counter#
Archivos eliminados de papelara de reciclaje #counter1#
</cfoutput>
</pre>
<cfif sendmail is "yes">
<cfmail to="#adminmail#" from="#adminmail#" subject="Reporte de Mantenimiento">
Reporte de mantenimiento:
Inicio: #maketime1#, #makedate1#
Fin: #maketime2#, #makedate2#
Archivos procesados: #maillist.recordcount#
Archivos eliminados: #counter#
</cfmail>
</cfif>
