我正在制作一个创建自定义 PDF 的应用程序,将其邮寄,然后将其删除。我已经分别测试了所有 3 个组件并且它们可以工作,但是当我将它们放在一起时,电子邮件不会发送。
是否有可能在发送电子邮件之前删除附件,即使删除位于脚本中的附件之后?
这是我的代码。
<!---Get the PDF--->
<cfscript>
PDFBuilder = createobject("component", "form_admin.email.PDFBuilder" );
pdf = PDFBuilder.createPDF(form_id);
</cfscript>
<!---Create link to the pdf --->
<cfscript>
foo = expandPath('../email/tmp/') & pdf & '.pdf';
</cfscript>
<!---Create email--->
<cfmail to="will@hazardousfrog.com"
from="will@hazardoufrog.com"
subject="Jag intrest form. "
type="text/html" >
<cfmailparam file="#foo#">
Dear #getEmail.title#, #getEmail.first_name# #getEmail.surname# <br />
Attached is a PDF boucher telling you more information about the cars you were interested in. <br />
Best wishes <br />
Jaguar <br /><br /><br /><br /><br /><br /><br /><br />
This is not actually jaguar this is a test application by Hazardousfrog.
</cfmail>
<!---Delete the file after it has been sent --->
<cfif FileExists(#foo#)>
<cffile action="delete"
file="#foo#">
<cfelse>
<cfoutput >
error
</cfoutput>
<cfabort>
</cfif>
抱歉,如果代码不是很好,我只做了 2 周的 CF。