Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to mail file automatically after it has been created?

Status
Not open for further replies.

ruxshin

Programmer
Apr 26, 2001
33
FI
Hi,

I'm using cfschedule to schedule query jobs (query_process.cfm), and then publish the result as a file (query_result.htm). If I want to sent the query result automatically to the user using cfmail after the file has been created, where should I put the cfmail tag? I've tried putting the cfmail and cfmailparam tags in the query_process.cfm template, but I didn't receive the any mail at all. When I checked the query_result.htm file, I have this error: Cfmailparam error: File Does Not Exist

So, what should I do? Where is the correct place to put the cfmail and cfmailparam tags to sent the created result file to the user?

ruxshin
 
You may need to test for the existence of the file first:

-------------------------------------------------------

<cfdirectory
action=&quot;LIST&quot;
directory=&quot;c:\temp&quot;
name=&quot;directory_list&quot;
>

<cfset fileFound = 0>
<cfloop query=&quot;directory_list&quot;>
<cfif directory_list.type EQ &quot;File&quot; AND directory_list.name EQ &quot;query_result.htm&quot;>
<cfset fileFound = 1>
<!--- Do mail in here --->
</cfif>
</cfloop>

<cfif NOT fileFound>
File could not be found.
</cfif>

--------------------------------------------------

You might even want to set it to loop until the file exists. Or if the file would have existed before the check, maybe the path you are using is incorrect. Post the code if necessary...


Miles
vmiles@senet.com.au
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top