Skip to main content
nikos101
Inspiring
December 14, 2009
Answered

Create a csv file and send it in an email

  • December 14, 2009
  • 2 replies
  • 1412 views

In coldfusion, is it possible to  create a csv file and send it in an email, without ever saving that file on the hard drive?

    This topic has been closed for replies.
    Correct answer Dan_Bracuk

    No.  You can't attach a file to an email unless the file has been created.

    We handle that situation by creating the file in a directory designated for dynamically created files.  We then have a scheduled job that cleans out all files more than a certain age every night.

    2 replies

    Inspiring
    December 14, 2009

    Yes, you can create an email attachment without writing a file to disk.  This feature was introduced in CF 8.0.1.

    I've posted a sample to a previous thread on the forums.

    http://forums.adobe.com/message/2123297

    See the CFMAILPARAM section of CF 8.0.1 release notes for attachments without a file on disk.

    http://www.adobe.com/support/documentation/en/coldfusion/801/cf801releasenotes.pdf

    Dan_BracukCorrect answer
    Inspiring
    December 14, 2009

    No.  You can't attach a file to an email unless the file has been created.

    We handle that situation by creating the file in a directory designated for dynamically created files.  We then have a scheduled job that cleans out all files more than a certain age every night.

    nikos101
    nikos101Author
    Inspiring
    December 14, 2009

    Thanks Dan, I guess I could just delete it straight away after sending it.


    Inspiring
    December 14, 2009

    No you can't delete it after you send it.  cfmail does not send mail, it creates a file in your spool directory.  The mail gets sent later and the spool directory gets emptied.  The file has to still exist when the mail files in the spool directory get sent.