 		and NAME not in (#listqualify(valuelist(allreports.REPORT_TEMPLATE),"'")#)
 	</cfquery>
 
-	<!--- IN is somehow not working properly, be safe and inefficient....
-	<cfset oldUnhandled=queryNew("template")>
-	<cfloop query="unhandled">
-		<cfquery name="isthere" dbtype="query">
-			select * from allreports where report_template
-		</cfquery>
-
-	</cfloop>
-	---->
+
+
+	<cfmail to="#maddr#" bcc="#Application.LogEmail#" subject="#subj#" from="loan_notification@#Application.fromEmail#" type="html">
+
+		The following report templates are 30 days old, have no template, and have been DELETED from Arctos.
+
+
+		<cfloop query="unhandled">
+			<br>#name#
+			<cfmailparam file = "#Application.serverRootURL#/Reports/templates/#name#" type="text/plain">
+		</cfloop>
+	</cfmail>
+
+
+
+
+
 	<cfdump var=#unhandled#>
 
 	<cfdump var=#allreports#>
 
 
 
-Elapsed: 00:00:00.39
-UAM@ARCTEST> desc cf_report_sql
- Name								   Null?    Type
- ----------------------------------------------------------------- -------- --------------------------------------------
- REPORT_ID							   NOT NULL NUMBER
- REPORT_NAME							   NOT NULL VARCHAR2(38)
- REPORT_TEMPLATE						   NOT NULL VARCHAR2(38)
- SQL_TEXT								    VARCHAR2(4000)
- PRE_FUNCTION								    VARCHAR2(50)
- REPORT_FORMAT							   NOT NULL VARCHAR2(50)
- LAST_ACCESS								    DATE
-
-	<cfquery name="allreports" datasource="uam_god">
-		select
-			REPORT_ID,
-			REPORT_NAME,
-			REPORT_TEMPLATE,
-			SQL_TEXT,
-			PRE_FUNCTION,
-			LAST_ACCESS,
-			round(sysdate-last_access) days_since_access
-		from
-			cf_report_sql
-		where
-			round(sysdate-last_access) in (#afn#)
-	</cfquery>
-	<!--- send distinct emails for all events---->
-	<!---- send all emails to everyone ---->
-	<cfquery name="cc" datasource="uam_god">
-		select
-			get_address(collection_contacts.CONTACT_AGENT_ID,'email') address
-		FROM
-			collection_contacts
-		where
-			collection_contacts.contact_role='data quality'
-		group by
-			get_address(collection_contacts.CONTACT_AGENT_ID,'email')
-	</cfquery>
-	<cfif isdefined("Application.version") and  Application.version is "prod">
-		<cfset subj="Arctos Report Access Notification">
-		<cfset maddr="#valuelist(cc.address)#, arctos.database@gmail.com">
-	<cfelse>
-		<cfset maddr=application.bugreportemail>
-		<cfset subj="TEST PLEASE IGNORE: Arctos Report Access Notification">
-	</cfif>
-	mailing to:#maddr#
 
 
 



	---->
	<cfset afn="30,60,90,120,180,365">

    <cfdirectory action="list" directory="#Application.webDirectory#/Reports/templates" filter="*.cfr" name="reportList" sort="name ASC">

	<cfdump var=#nohandler30#>
	mail to everyone....


	<cfabort>

<p>
				<br>REPORT_NAME: #REPORT_NAME#
				<br>REPORT_TEMPLATE: #REPORT_TEMPLATE#
				<br>PRE_FUNCTION: #PRE_FUNCTION#
				<br>SQL_TEXT: #SQL_TEXT#
				<br>LAST_ACCESS: #LAST_ACCESS# (#days_since_access# days)



