[cfaussie] Re: CFMAIL Maintenance

2007-07-18 Thread mpicker

Just sorry about the double post.  Having a lot of trouble with my
Google account lately.

Cheers
Mark

On Jul 18, 11:32 am, Scott Thornton
[EMAIL PROTECTED] wrote:
 awesome!

  mpicker [EMAIL PROTECTED] 18/07/2007 11:24 am 

 Hi Scott,

 Please see below a cfm page we run as a schedule every night to deal
 with undeliverable mails.

 What this script does is each night move the undeliverable emails back
 to the spool to try and deliver them (just in case it was network,
 server etc issues that stopped it from being delivered).  Once the
 emails get past a week old and still can't be delivered it moves them
 into a permanently rejected folder and will stop trying to send.  You
 can then delete them.

 It will also send you an email letting you know how many emails have
 been sent/moved etc.

 I didn't write this script (but did modify it), however I don't know
 where I got it from to create the original author.

 Regards,
 Mark Picker

 !--- Get the mail root directory ---
 cfset MailRoot=#server.ColdFusion.RootDir#\mail

 !--- set the date trigger to 7, one week ---
 cfset DateTrigger=7

 !--- Read all of the files from the undeliverable directory for
 processing ---
 cfdirectory action=List
  directory=#MailRoot#\undelivr
  name=Undeliverables
  filter=*.cfmail

 cfif Undeliverables.RecordCount eq 0
   cfset FilesMoved = 0
   cfset FilesRejected = 0
   cfset UndeliveredMail = QueryNew(FileName, FileSize, LastMod,
 Status)
   cfset QueryAddRow(UndeliveredMail)
   cfset QuerySetCell(UndeliveredMail, FileName, N/A, 1)
   cfset QuerySetCell(UndeliveredMail, FileSize, N/A, 1)
   cfset QuerySetCell(UndeliveredMail, LastMod, N/A, 1)
   cfset QuerySetCell(UndeliveredMail, Status, N/A, 1)
 cfelse
   !--- Set Constants ---
   cfset FilesMoved = 0
   cfset FilesRejected = 0
   cfset UndeliveredMail=QueryNew(FileName, FileSize, LastMod,
 Status)
   cfset QueryAddRow(UndeliveredMail, Undeliverables.RecordCount)

   cfloop Query=Undeliverables
 !---  if the last modified date of the file in the undelivr
 directory is
older than the date trigger, or if the file size is 0,
 delete it.
Otherwise, move the file to the spool directory to be
 resent. ---
 cfif (DateDiff(y, LSDateFormat(DateLastModified), Now()) gt
 DateTrigger)
or (Size eq 0)

 !--- Check to see if the Directory exists. ---
 cfif NOT DirectoryExists(#MailRoot#\Permanently_Rejected\)
 cfdirectory action = create directory = #MailRoot#
 \Permanently_Rejected 
 cfoutputpYour directory has been 
 created./p/cfoutput
 /cfif

   cffile action=Move
   source=#MailRoot#\undelivr\#Name#
   destination=#MailRoot#\Permanently_Rejected\#Name#

   cfset QuerySetCell(UndeliveredMail, FileName, Name,
   Undeliverables.CurrentRow)
   cfset QuerySetCell(UndeliveredMail, FileSize, Size,
   Undeliverables.CurrentRow)
   cfset QuerySetCell(UndeliveredMail, LastMod,
 DateLastModified,
   Undeliverables.CurrentRow)
  cfset QuerySetCell(UndeliveredMail, Status, Rejected,
   Undeliverables.CurrentRow)
   cfset FilesRejected = FilesRejected + 1
 cfelse
   cffile action=Move
   source=#MailRoot#\undelivr\#Name#
   destination=#MailRoot#\spool\#Name#
cfset QuerySetCell(UndeliveredMail, FileName, Name,
   Undeliverables.CurrentRow)
cfset QuerySetCell(UndeliveredMail, FileSize, Size,
   Undeliverables.CurrentRow)
   cfset QuerySetCell(UndeliveredMail, LastMod,
 DateLastModified,
   Undeliverables.CurrentRow)
   cfset QuerySetCell(UndeliveredMail, Status, Rejected,
   Undeliverables.CurrentRow)
   cfset FilesMoved = FilesMoved+1
 /cfif
   /cfloop
 /cfif

 cfif FilesMoved gte 1 or FilesRejected gte 1
 cfmail query=UndeliveredMail
 to= [EMAIL PROTECTED] 
 from=[EMAIL PROTECTED]
 subject=Undeliverable Mail Report for Server
 #CGI.Server_Name#
 Total Files Moved to Spool: #FilesMoved#
 Total Files Rejected: #FilesRejected#

 These are the files affected:
 cfoutput
 #Status#: #FileName# (#filesize# bytes, #DateFormat(LastMod,'mm/dd/
 ')#)
 /cfoutput
 /cfmail
 /cfif

 h2Task Completedh2


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---



[cfaussie] Re: CFMAIL Maintenance

2007-07-18 Thread mpicker

Sorry, when I said to create the original author I meant  to credit
the original author.  I also realised I posted the unmodified script,
but that was probably for best anyway. 

I have a feeling I got the script from one of Ben Forta's books.

Cheers
Mark


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---



[cfaussie] Re: CFMAIL Maintenance

2007-07-17 Thread Sarah Barry

They get put into undeliver when the message cannot get delivered for
any number of connection problems
They just sit there - up to you to clean them out and check/trace the
reason why they fail

Ciao
sarah

-Original Message-
From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Scott Thornton
Sent: Tuesday, 17 July 2007 3:54 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] CFMAIL Maintenance


Hi,

I was just now checking out my Mail directory under the CFusionMX
directory and in the Undelivr directory there are a bunch of mail
message dateing back to September 06.

Obviously I no longer most of these but I was wondering if someone could
provide an idea of when the mail message ends up in the undelivr
directory and at what point it can be deleted (I am not sure if they are
re-sent from this directory)?

Thanks,






--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---



[cfaussie] Re: CFMAIL Maintenance

2007-07-17 Thread Barry Beattie

On 7/17/07, Sarah Barry [EMAIL PROTECTED] wrote:

 They get put into undeliver when the message cannot get delivered for
 any number of connection problems
 They just sit there - up to you to clean them out and check/trace the
 reason why they fail

so I suppose (and I'm just throwing this out there, I don't do a lot
with CFMAIL), if it has a connectivity problem it could be
logged/database entry so it could be retried a second, third time
and/or details sent to admin to follow up.

or (for CF7) put a directory watcher on the directory for any bad
emails falling into the undeliver  directory?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---



[cfaussie] Re: CFMAIL Maintenance

2007-07-17 Thread Sarah Barry

No because coldfusion passes the emailing to smtp and the problems are
smtp problems
The speed that they get put into the undeliver depends on the frequency
the CF server has been set to connect to the smtp server
To rerun them you could scoop them back into the spool folder which is
where cf puts them while waiting for the smtp kick-in

And yes the Better check is to check the contents of the undeliver
folder as a scheduled job

Ciao
s

-Original Message-
From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Barry Beattie
Sent: Tuesday, 17 July 2007 4:39 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: CFMAIL Maintenance


On 7/17/07, Sarah Barry [EMAIL PROTECTED] wrote:

 They get put into undeliver when the message cannot get delivered for
 any number of connection problems
 They just sit there - up to you to clean them out and check/trace the
 reason why they fail

so I suppose (and I'm just throwing this out there, I don't do a lot
with CFMAIL), if it has a connectivity problem it could be
logged/database entry so it could be retried a second, third time
and/or details sent to admin to follow up.

or (for CF7) put a directory watcher on the directory for any bad
emails falling into the undeliver  directory?



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---



[cfaussie] Re: CFMAIL Maintenance

2007-07-17 Thread Sarah Barry

Scott,

We are still running CF MX 6
You can still run a scheduled job to report on the undeliver
folder.
I run a daily job that reports on student FTP uploads by looking
at the upload directory and report is emailed to student admin.
If there are no files just don't send the message

Ciao
s

-Original Message-
From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Scott Thornton
Sent: Tuesday, 17 July 2007 4:44 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] CFMAIL Maintenance


Hi,

CF MX 6.1

I guess I will just need to get in and clear it out from time to time.



 Barry Beattie [EMAIL PROTECTED] 17/07/2007 4:39 pm 

On 7/17/07, Sarah Barry [EMAIL PROTECTED] wrote:

 They get put into undeliver when the message cannot get delivered for
 any number of connection problems
 They just sit there - up to you to clean them out and check/trace the
 reason why they fail

so I suppose (and I'm just throwing this out there, I don't do a lot
with CFMAIL), if it has a connectivity problem it could be
logged/database entry so it could be retried a second, third time
and/or details sent to admin to follow up.

or (for CF7) put a directory watcher on the directory for any bad
emails falling into the undeliver  directory?






--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---



[cfaussie] Re: CFMAIL Maintenance

2007-07-17 Thread Sarah Barry

I think CF has finished with them cos they just stay there until acted
on
But perhaps the mailer needs to keep trying?

-Original Message-
From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Scott Thornton
Sent: Wednesday, 18 July 2007 9:08 AM
To: cfaussie@googlegroups.com
Subject: [cfaussie] CFMAIL Maintenance


Hi,

Last question.

When the mail is placed in the undelivered folder, is coldfusion
finished with them as far as it is concerned? I assuming yes? It doesn't
retry them at some point?

The reason I ask is that I am getting some weird stuff in my mail server
logs like:

Error,scheduler-3,07/18/07,09:04:18,,missing body for message
Error,scheduler-7,07/18/07,09:04:34,,missing body for message
Error,scheduler-0,07/18/07,09:04:49,,missing body for message
Error,scheduler-3,07/18/07,09:05:06,,missing body for message
Error,scheduler-2,07/18/07,09:05:21,,missing body for message
Error,scheduler-3,07/18/07,09:05:36,,missing body for message
Error,scheduler-0,07/18/07,09:05:51,,missing body for message
Error,scheduler-6,07/18/07,09:06:07,,missing body for message

but when I check my mail and undelivered folder, all seem to have bodies
inside the messages.

 Sarah Barry [EMAIL PROTECTED] 17/07/2007 4:43 pm 

No because coldfusion passes the emailing to smtp and the problems are
smtp problems
The speed that they get put into the undeliver depends on the frequency
the CF server has been set to connect to the smtp server
To rerun them you could scoop them back into the spool folder which is
where cf puts them while waiting for the smtp kick-in

And yes the Better check is to check the contents of the undeliver
folder as a scheduled job

Ciao
s

-Original Message-
From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Barry Beattie
Sent: Tuesday, 17 July 2007 4:39 PM
To: cfaussie@googlegroups.com 
Subject: [cfaussie] Re: CFMAIL Maintenance


On 7/17/07, Sarah Barry [EMAIL PROTECTED] wrote:

 They get put into undeliver when the message cannot get delivered for
 any number of connection problems
 They just sit there - up to you to clean them out and check/trace the
 reason why they fail

so I suppose (and I'm just throwing this out there, I don't do a lot
with CFMAIL), if it has a connectivity problem it could be
logged/database entry so it could be retried a second, third time
and/or details sent to admin to follow up.

or (for CF7) put a directory watcher on the directory for any bad
emails falling into the undeliver  directory?








--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---



[cfaussie] Re: CFMAIL Maintenance

2007-07-17 Thread mpicker

Hi Scott,

Please see below a cfm page we run as a schedule every night to deal
with undeliverable mails.

What this script does is each night move the undeliverable emails back
to the spool to try and deliver them (just in case it was network,
server etc issues that stopped it from being delivered).  Once the
emails get past a week old and still can't be delivered it moves them
into a permanently rejected folder and will stop trying to send.  You
can then delete them.

It will also send you an email letting you know how many emails have
been sent/moved etc.

I didn't write this script (but did modify it), however I don't know
where I got it from to create the original author.

Regards,
Mark Picker



!--- Get the mail root directory ---
cfset MailRoot=#server.ColdFusion.RootDir#\mail

!--- set the date trigger to 7, one week ---
cfset DateTrigger=7

!--- Read all of the files from the undeliverable directory for
processing ---
cfdirectory action=List
 directory=#MailRoot#\undelivr
 name=Undeliverables
 filter=*.cfmail

cfif Undeliverables.RecordCount eq 0
  cfset FilesMoved = 0
  cfset FilesRejected = 0
  cfset UndeliveredMail = QueryNew(FileName, FileSize, LastMod,
Status)
  cfset QueryAddRow(UndeliveredMail)
  cfset QuerySetCell(UndeliveredMail, FileName, N/A, 1)
  cfset QuerySetCell(UndeliveredMail, FileSize, N/A, 1)
  cfset QuerySetCell(UndeliveredMail, LastMod, N/A, 1)
  cfset QuerySetCell(UndeliveredMail, Status, N/A, 1)
cfelse
  !--- Set Constants ---
  cfset FilesMoved = 0
  cfset FilesRejected = 0
  cfset UndeliveredMail=QueryNew(FileName, FileSize, LastMod,
Status)
  cfset QueryAddRow(UndeliveredMail, Undeliverables.RecordCount)

  cfloop Query=Undeliverables
!---  if the last modified date of the file in the undelivr
directory is
   older than the date trigger, or if the file size is 0,
delete it.
   Otherwise, move the file to the spool directory to be
resent. ---
cfif (DateDiff(y, LSDateFormat(DateLastModified), Now()) gt
DateTrigger)
   or (Size eq 0)

!--- Check to see if the Directory exists. ---
cfif NOT DirectoryExists(#MailRoot#\Permanently_Rejected\)
cfdirectory action = create directory = #MailRoot#
\Permanently_Rejected 
cfoutputpYour directory has been 
created./p/cfoutput
/cfif


  cffile action=Move
  source=#MailRoot#\undelivr\#Name#
  destination=#MailRoot#\Permanently_Rejected\#Name#

  cfset QuerySetCell(UndeliveredMail, FileName, Name,
  Undeliverables.CurrentRow)
  cfset QuerySetCell(UndeliveredMail, FileSize, Size,
  Undeliverables.CurrentRow)
  cfset QuerySetCell(UndeliveredMail, LastMod,
DateLastModified,
  Undeliverables.CurrentRow)
 cfset QuerySetCell(UndeliveredMail, Status, Rejected,
  Undeliverables.CurrentRow)
  cfset FilesRejected = FilesRejected + 1
cfelse
  cffile action=Move
  source=#MailRoot#\undelivr\#Name#
  destination=#MailRoot#\spool\#Name#
   cfset QuerySetCell(UndeliveredMail, FileName, Name,
  Undeliverables.CurrentRow)
   cfset QuerySetCell(UndeliveredMail, FileSize, Size,
  Undeliverables.CurrentRow)
  cfset QuerySetCell(UndeliveredMail, LastMod,
DateLastModified,
  Undeliverables.CurrentRow)
  cfset QuerySetCell(UndeliveredMail, Status, Rejected,
  Undeliverables.CurrentRow)
  cfset FilesMoved = FilesMoved+1
/cfif
  /cfloop
/cfif

cfif FilesMoved gte 1 or FilesRejected gte 1
cfmail query=UndeliveredMail
to= [EMAIL PROTECTED] 
from=[EMAIL PROTECTED]
subject=Undeliverable Mail Report for Server
#CGI.Server_Name#
Total Files Moved to Spool: #FilesMoved#
Total Files Rejected: #FilesRejected#

These are the files affected:
cfoutput
#Status#: #FileName# (#filesize# bytes, #DateFormat(LastMod,'mm/dd/
')#)
/cfoutput
/cfmail
/cfif

h2Task Completedh2


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---



[cfaussie] Re: CFMAIL Maintenance

2007-07-17 Thread Mark Picker

Hi Scott,

Please see below a cfm page we run as a schedule every night to deal
with undeliverable mails.

What this script does is each night move the undeliverable emails back
to the spool to try and deliver them (just in case it was network,
server etc issues that stopped it from being delivered).  Once the
emails get past a week old and still can't be delivered it moves them
into a permanently rejected folder and will stop trying to send.  You
can then delete them.

It will also send you an email letting you know how many emails have
been sent/moved etc.

I didn't write this script (but did modify it), however I don't know
where I got it from to create the original author.

Regards,

Mark Picker
Internet Developer - External Business Systems
http://www.wit.tafensw.edu.au/

Regional ICT Unit
TAFE NSW - Western Institute
Direct Line : (02) 6885 7538
Institute Office : (02) 6885 7522
Fax Number : (02) 6885 7581 (updated)


!--- Get the mail root directory ---
cfset MailRoot=#server.ColdFusion.RootDir#\mail

!--- set the date trigger to 7, one week ---
cfset DateTrigger=7

!--- Read all of the files from the undeliverable directory for
processing ---
cfdirectory action=List
 directory=#MailRoot#\undelivr
 name=Undeliverables
 filter=*.cfmail

cfif Undeliverables.RecordCount eq 0
  cfset FilesMoved = 0
  cfset FilesRejected = 0
  cfset UndeliveredMail = QueryNew(FileName, FileSize, LastMod,
Status)
  cfset QueryAddRow(UndeliveredMail)
  cfset QuerySetCell(UndeliveredMail, FileName, N/A, 1)
  cfset QuerySetCell(UndeliveredMail, FileSize, N/A, 1)
  cfset QuerySetCell(UndeliveredMail, LastMod, N/A, 1)
  cfset QuerySetCell(UndeliveredMail, Status, N/A, 1)
cfelse
  !--- Set Constants ---
  cfset FilesMoved = 0
  cfset FilesRejected = 0
  cfset UndeliveredMail=QueryNew(FileName, FileSize, LastMod,
Status)
  cfset QueryAddRow(UndeliveredMail, Undeliverables.RecordCount)

  cfloop Query=Undeliverables
!---  if the last modified date of the file in the undelivr
directory is
   older than the date trigger, or if the file size is 0,
delete it.
   Otherwise, move the file to the spool directory to be
resent. ---
cfif (DateDiff(y, LSDateFormat(DateLastModified), Now()) gt
DateTrigger)
   or (Size eq 0)

!--- Check to see if the Directory exists. ---
cfif NOT DirectoryExists(#MailRoot#\Permanently_Rejected\)
cfdirectory action = create directory = #MailRoot#
\Permanently_Rejected 
cfoutputpYour directory has been 
created./p/cfoutput
/cfif


  cffile action=Move
  source=#MailRoot#\undelivr\#Name#
  destination=#MailRoot#\Permanently_Rejected\#Name#

  cfset QuerySetCell(UndeliveredMail, FileName, Name,
  Undeliverables.CurrentRow)
  cfset QuerySetCell(UndeliveredMail, FileSize, Size,
  Undeliverables.CurrentRow)
  cfset QuerySetCell(UndeliveredMail, LastMod,
DateLastModified,
  Undeliverables.CurrentRow)
 cfset QuerySetCell(UndeliveredMail, Status, Rejected,
  Undeliverables.CurrentRow)
  cfset FilesRejected = FilesRejected + 1
cfelse
  cffile action=Move
  source=#MailRoot#\undelivr\#Name#
  destination=#MailRoot#\spool\#Name#
   cfset QuerySetCell(UndeliveredMail, FileName, Name,
  Undeliverables.CurrentRow)
   cfset QuerySetCell(UndeliveredMail, FileSize, Size,
  Undeliverables.CurrentRow)
  cfset QuerySetCell(UndeliveredMail, LastMod,
DateLastModified,
  Undeliverables.CurrentRow)
  cfset QuerySetCell(UndeliveredMail, Status, Rejected,
  Undeliverables.CurrentRow)
  cfset FilesMoved = FilesMoved+1
/cfif
  /cfloop
/cfif

cfif FilesMoved gte 1 or FilesRejected gte 1
cfmail query=UndeliveredMail
to= [EMAIL PROTECTED] 
from=[EMAIL PROTECTED]
subject=Undeliverable Mail Report for Server
#CGI.Server_Name#
Total Files Moved to Spool: #FilesMoved#
Total Files Rejected: #FilesRejected#

These are the files affected:
cfoutput
#Status#: #FileName# (#filesize# bytes, #DateFormat(LastMod,'mm/dd/
')#)
/cfoutput
/cfmail
/cfif

h2Task Completedh2




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---



[cfaussie] Re: CFMAIL Maintenance

2007-07-17 Thread Sarah Barry

Thanks Mark!

-Original Message-
From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Mark Picker
Sent: Wednesday, 18 July 2007 11:23 AM
To: cfaussie
Subject: [cfaussie] Re: CFMAIL Maintenance


Hi Scott,

Please see below a cfm page we run as a schedule every night to deal
with undeliverable mails.

What this script does is each night move the undeliverable emails back
to the spool to try and deliver them (just in case it was network,
server etc issues that stopped it from being delivered).  Once the
emails get past a week old and still can't be delivered it moves them
into a permanently rejected folder and will stop trying to send.  You
can then delete them.

It will also send you an email letting you know how many emails have
been sent/moved etc.

I didn't write this script (but did modify it), however I don't know
where I got it from to create the original author.

Regards,

Mark Picker
Internet Developer - External Business Systems
http://www.wit.tafensw.edu.au/

Regional ICT Unit
TAFE NSW - Western Institute
Direct Line : (02) 6885 7538
Institute Office : (02) 6885 7522
Fax Number : (02) 6885 7581 (updated)


!--- Get the mail root directory ---
cfset MailRoot=#server.ColdFusion.RootDir#\mail

!--- set the date trigger to 7, one week ---
cfset DateTrigger=7

!--- Read all of the files from the undeliverable directory for
processing ---
cfdirectory action=List
 directory=#MailRoot#\undelivr
 name=Undeliverables
 filter=*.cfmail

cfif Undeliverables.RecordCount eq 0
  cfset FilesMoved = 0
  cfset FilesRejected = 0
  cfset UndeliveredMail = QueryNew(FileName, FileSize, LastMod,
Status)
  cfset QueryAddRow(UndeliveredMail)
  cfset QuerySetCell(UndeliveredMail, FileName, N/A, 1)
  cfset QuerySetCell(UndeliveredMail, FileSize, N/A, 1)
  cfset QuerySetCell(UndeliveredMail, LastMod, N/A, 1)
  cfset QuerySetCell(UndeliveredMail, Status, N/A, 1)
cfelse
  !--- Set Constants ---
  cfset FilesMoved = 0
  cfset FilesRejected = 0
  cfset UndeliveredMail=QueryNew(FileName, FileSize, LastMod,
Status)
  cfset QueryAddRow(UndeliveredMail, Undeliverables.RecordCount)

  cfloop Query=Undeliverables
!---  if the last modified date of the file in the undelivr
directory is
   older than the date trigger, or if the file size is 0,
delete it.
   Otherwise, move the file to the spool directory to be
resent. ---
cfif (DateDiff(y, LSDateFormat(DateLastModified), Now()) gt
DateTrigger)
   or (Size eq 0)

!--- Check to see if the Directory exists. ---
cfif NOT
DirectoryExists(#MailRoot#\Permanently_Rejected\)
cfdirectory action = create directory =
#MailRoot#
\Permanently_Rejected 
cfoutputpYour directory has been
created./p/cfoutput
/cfif


  cffile action=Move
  source=#MailRoot#\undelivr\#Name#
  destination=#MailRoot#\Permanently_Rejected\#Name#

  cfset QuerySetCell(UndeliveredMail, FileName, Name,
  Undeliverables.CurrentRow)
  cfset QuerySetCell(UndeliveredMail, FileSize, Size,
  Undeliverables.CurrentRow)
  cfset QuerySetCell(UndeliveredMail, LastMod,
DateLastModified,
  Undeliverables.CurrentRow)
 cfset QuerySetCell(UndeliveredMail, Status, Rejected,
  Undeliverables.CurrentRow)
  cfset FilesRejected = FilesRejected + 1
cfelse
  cffile action=Move
  source=#MailRoot#\undelivr\#Name#
  destination=#MailRoot#\spool\#Name#
   cfset QuerySetCell(UndeliveredMail, FileName, Name,
  Undeliverables.CurrentRow)
   cfset QuerySetCell(UndeliveredMail, FileSize, Size,
  Undeliverables.CurrentRow)
  cfset QuerySetCell(UndeliveredMail, LastMod,
DateLastModified,
  Undeliverables.CurrentRow)
  cfset QuerySetCell(UndeliveredMail, Status, Rejected,
  Undeliverables.CurrentRow)
  cfset FilesMoved = FilesMoved+1
/cfif
  /cfloop
/cfif

cfif FilesMoved gte 1 or FilesRejected gte 1
cfmail query=UndeliveredMail
to= [EMAIL PROTECTED] 
from=[EMAIL PROTECTED]
subject=Undeliverable Mail Report for Server
#CGI.Server_Name#
Total Files Moved to Spool: #FilesMoved#
Total Files Rejected: #FilesRejected#

These are the files affected:
cfoutput
#Status#: #FileName# (#filesize# bytes, #DateFormat(LastMod,'mm/dd/
')#)
/cfoutput
/cfmail
/cfif

h2Task Completedh2






--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~--~~~~--~~--~--~---