Skip to main content
Inspiring
November 4, 2008
Answered

Attaching generated excel file in cfmail

  • November 4, 2008
  • 2 replies
  • 1868 views
Hi,

I've attached the code in which I've generated an excel file from my data, which the user can then open/save on their PC. I now want to attach this excel file to an email (using cfmail) and send it (the task will then become scheduled).

How do I save rather than output the excel file?

Katie
This topic has been closed for replies.
Correct answer fober1
Hi,

Have a look at the following tags:

1)
<cfsavecontent> to generate a variable from your tab-delimited content
<cffile action = "write"> to generate a temp file with your content
<cfmail> and attach that file to your email
or
2)
<cfsavecontent>
<cfmail>,<cfmailpart> to attach the variable directly to the email without creating a temp file first (have not tried that myself)

cheers,
fober

2 replies

fober1Correct answer
Inspiring
November 4, 2008
Hi,

Have a look at the following tags:

1)
<cfsavecontent> to generate a variable from your tab-delimited content
<cffile action = "write"> to generate a temp file with your content
<cfmail> and attach that file to your email
or
2)
<cfsavecontent>
<cfmail>,<cfmailpart> to attach the variable directly to the email without creating a temp file first (have not tried that myself)

cheers,
fober
Inspiring
November 5, 2008
Thanks you both, I'll let you know how I get on :)

Katie

Inspiring
November 4, 2008
Using cfcontent does not create an excel file on your server. It gives the user the opportunity to save a .xls file on their local machine, or to view the contents in a version of excel that opens in a browswer. This means it's not available to email using cold fusion.

I know you can create excel files on your server with cf, but I don't know how.