尝试使用CFMail发送带附件的邮件时出错

时间:2012-06-20 18:22:17

标签: coldfusion coldfusion-9 cfmail

我正在尝试向其发送附带文件的电子邮件,但我收到的错误是我不熟悉的。

这是<cfmail>代码的代码:

<CFMAIL FROM="test@test.com" TO="test2@test2.com"  SUBJECT="Test" type="HTML">
<P> This is the attachments test</P>
<p> For this test to be successful, we need to receive some file attachments with this email</p>
  <cfsilent>
    <cfloop query="result">

        <cfmailparam file="#result.NAME#" disposition="attachment">

    </cfloop>
  </cfsilent>
</cfmail>

这就是错误:

The resource 2011093475839213.txt was not found.

**The root cause was: ''.**

The error occurred in E:\sites\Example.Com\FolderExistsTest.cfm: line 71
69 :     <cfloop query="result">
70 :       
71 :         <cfmailparam file="#result.NAME#" disposition="attachment" type="text">
72 :     
73 :     </cfloop>

请注意,我尝试附加的文件确实存在。

1 个答案:

答案 0 :(得分:1)

这是指定文件路径的正确方法。

   <cfmailparam file="#CurrentDirectory#\#result.NAME#" disposition="attachment" type="text">