Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8483025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:58:28+00:00 2026-06-10T19:58:28+00:00

I am making an app that creates a custom PDF, mails it and then

  • 0

I am making an app that creates a custom PDF, mails it and then deletes it. I have tested all 3 components separately and they work but when I put them together the email doesn’t send.

Is it possible that the attachment gets deleted before the email is sent even though the delete is after it in the script?

Here is my code.

<!---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>

Sorry if the code isn’t great I have only been doing CF for like 2 weeks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:58:30+00:00Added an answer on June 10, 2026 at 7:58 pm

    Ok I managed to get the answer from a work friend.

    When cfmail is processed the mail is saved into a spool and periodically sent out after about 3 mins.
    In my case it meant that the email PDF attachment was being deleted before the message could be sent so the mail was not sending.

    The coldFusion mail tag has an attribute to send it straight away or keep it spooled.

    spoolenable : Whether to spool mail or always send it Immediately.

    So to get it to get my code to work I added this line to my mail attributes.

    spoolenable="false"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So im making an app that creates events by filling in a form then
I'm making an app that displays a custom notification in the notification bar, and
I am currently making an app that will have multiple timers, which are basically
I have an application I am making that creates a large number of windows
i'm making app that the main page include TableView but i want when i
I am making app that takes a screenshot of a URL requested by the
Im making an app that should let the user see video from the camera
I am making an app that records a destination (a city, state, country, town,
I'm making an app that is requesting data from a Web Service (implementing Soap).
I am making an app that has both a bottom bar and a top

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.