0

下面是我的代码。我需要发送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在电子邮件中发送。

4

2 回答 2

0

将 files.name 添加到您的电子邮件非常简单。Cfdirectory 返回一个查询,因此 files 是一个查询。要将查询结果输出到邮件标签,只需遍历它。

<cfoop query="files">
#data from files#
</cfloop>

当然,您需要添加自己的格式。另请注意,cfmail 标记具有隐式 cfoutput 标记,因此您无需添加自己的标记。

于 2013-11-11T15:50:09.757 回答
0

您可以使用valueList或quotedValueList从 cfdirectory 查询对象中获取任何列的所有值,而无需遍历每个值:

Here is the list of files:
#valueList(files.name)#
于 2013-11-11T16:07:42.043 回答