【问题标题】:Error attempting to send mail with attachment using CFMail尝试使用 CFMail 发送带有附件的邮件时出错
【发布时间】:2014-01-30 19:09:53
【问题描述】:

我正在尝试发送一封带有附件的电子邮件,但我收到了一个我不熟悉的错误。

这是我的<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>

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

【问题讨论】:

  • 您正在向 cfmailparam 发送文件名 (2011093475839213.txt)。您不必指定完整路径“C:\WebServerPath\Files\2011093475839213.txt”
  • 我发现了错误,你是对的。这是解决方案:&lt;cfmailparam file="#CurrentDirectory#\#result.NAME#" disposition="attachment" type="text"&gt;
  • 如果江铃提供了解决方案,他应该将其作为答案发布,以便您接受它
  • 我在 JMC 在这里发布他的建议之前找到了解决方案,但我很乐意将他的正确答案归功于他,因为他是正确的。

标签: coldfusion coldfusion-9 cfmail


【解决方案1】:

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

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

【讨论】:

  • 不要忘记“接受”答案,作为未来读者的路标。
  • 我必须等到明天才能接受我自己的答案。明天我会确保将其标记为已接受的第一件事。谢谢
猜你喜欢
  • 1970-01-01
  • 2019-01-11
  • 1970-01-01
  • 1970-01-01
  • 2017-06-16
  • 2018-04-27
  • 2017-10-30
  • 2021-09-01
相关资源
最近更新 更多