 <!--- local table just for this
 create table cf_temp_classification_fh as select * from cf_temp_classification where 1=2;
-
- --->
-<!--- queue ---->
+	 alter table cf_temp_classification_fh add export_id varchar2(255);
+
+	 --->
+
 <cfoutput>
+	<!--- send email for any previous exports ---->
+	<cfquery name="rtn" datasource="uam_god">
+		select
+			DATASET_ID,
+			SEED_TERM,
+			USERNAME,
+			EXPORT_ID,
+			get_address(agent_id,'email') email
+		 from
+		 	htax_export,
+		 	agent_name
+		 where
+			upper(htax_export.username)=upper(agent_name.agent_name) and
+			agent_name_type='login' and
+			status='export_done'
+	</cfquery>
+
+	<cfloop query="rtn">
+		<cfif len(email) gt 0>
+			<cfmail to="#email#" subject="taxonomy export" cc="arctos.database@gmail.com" from="class_export@#Application.fromEmail#" type="html">
+				Dear #username#,
+				<p>
+					Your export of #SEED_TERM# and children is available at
+					#application.serverRootURL#//tools/taxonomyTree.cfm?action=manageExports&EXPORT_ID=#EXPORT_ID#
+				</p>
+			</cfmail>
+			<cfquery name="sem" datasource="uam_god">
+				update htax_export set status='email_sent' where EXPORT_ID='#EXPORT_ID#'
+			</cfquery>
+		<cfelse>
+			<cfquery name="sem" datasource="uam_god">
+				update htax_export set status='email_not_sent_noaddress' where EXPORT_ID='#EXPORT_ID#'
+			</cfquery>
+		</cfif>
+	</cfloop>
+
+	<!--- queue ---->
 
 	<cfquery name="q" datasource="uam_god">
 		select * from htax_export where status='ready_to_push_bl'
 	</cfquery>
+
 	<cfif q.recordcount is 0>
 		nothing to do<cfabort>
 	</cfif>

	</cfquery>

	<!---- column names in order ---->
	<cfquery name="CTTAXON_TERM" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
		select
			*
		from

		<cfquery name="ud" datasource="uam_god">
			update htax_export set status='export_done' where export_id='#q.export_id#'
		</cfquery>
		<cfabort>
	</cfif>

	<cfquery name="dataset" datasource="uam_god">
