以下是我的代码。我需要在电子邮件的内容中发送files.name[i]
。请告诉我怎么做?给我一个提示,我会尝试。
<meta http-equiv="refresh" content="300">
<html>
<head>
<script language="javascript" src="JS/jQuery.js"></script>
<script>
function page_refresh(){
document.getElementById('form2').action="project_file_dir.cfm"
document.getElementById('form2').submit();
}
</script>
</head>
<body >
<cfoutput>
<cfset fileLocation ="\\squeaker\SiSystemsFile\WebServices\WebSites\Perforce\Bhargavi"> <!--- On mac set to /tmp --->
<cfdirectory
action = "list"
directory = "#fileLocation#"
name = "files"
filter="*.*">
<form method="post" id="form2">
<cfset f="#files.recordcount#">
<cfset mydatetime=now()>
<cfset a=TimeFormat(MyDateTime,'hh:mm:ss tt')>
Total File in <b> #fileLocation# </b> Count is <b> #f# </b> #TimeFormat(MyDateTime,'hh:mm tt')#
<input type="button" name="Refresh" value="refresh" onclick="page_refresh()"><br>
<b>Next Run</b>
<cfset b=TimeFormat(DateAdd('n', +5, MyDateTime),'hh:mm:ss tt')>
#TimeFormat(DateAdd('n', +5, MyDateTime),'hh:mm tt')#
</cfoutput>
<!--- <cfset min_change= Minute(Now())>
<cfset bin=min_change %5>
<cfif bin eq 0>
<cfinclude template="project_file_dir.cfm">
</cfif> --->
<cfloop index = "i" from = "1" to = #f#>
<cfoutput>
#files.name[i]# <br>
</cfoutput>
</cfloop>
</form>
<cfmail to="Gayathri.p@sisystems.com"
from="bhargavi.kumar@sisystems.com"
subject="Testing the E-Mail"
type="text">
Dear Gayathri
I just send this mail for testing . Please Ignore this
Regards
Bhargavi
</cfmail>
<cfoutput>
<p>Thank you for registering.
We have just sent you an email.</p>
</cfoutput>
<!--- <cffile action="write"
addnewline="yes"
file="\\squeaker\SiSystemsFile\WebServices\WebSites\Perforce\Bhargavi\report.txt"
output="#f# "
fixnewline="yes"> --->
<!--- <cfloop index = "i" from = "1" to = #f#>
<cfoutput>
<cffile action="write"
addnewline="yes"
file="\\squeaker\SiSystemsFile\WebServices\WebSites\Perforce\Bhargavi\report.txt"
output="#files.name[i]#"
fixnewline="yes">
</cfoutput>
</cfloop> --->
</body>
</html>
我还必须每隔5分钟刷新页面,但我已经这样做了。我需要在电子邮件中发送files.name
。
答案 0 :(得分:0)
将files.name添加到您的电子邮件非常简单。 Cfdirectory返回一个查询,因此files是一个查询。要将查询结果输出到邮件标记,只需循环遍历它。
<cfoop query="files">
#data from files#
</cfloop>
当然,您需要添加自己的格式。另请注意,cfmail标记具有隐式cfoutput标记,因此您无需添加自己的标记。
答案 1 :(得分:0)
您可以使用valueList或quotedValueList从cfdirectory查询对象中获取任何列的所有值,而无需遍历每个列:
Here is the list of files:
#valueList(files.name)#