This content has been marked as final. Show 7 replies
you can create a pdf file with cfdocument.
you can mail it as a file attachment with cfmail and cfmailparam.
Thanks for the pointer, I've got the page generating PDF's, how do I attach that PDF to the e-mail response? I don't know how to call the name of the generated PDF and attach it using <cfmailparam>. Do i have to save the file to the server and then call it using a path? We had another developer build us an upload set once that would send us files as attachments, I tried to incorporate that code, but it dealt with a directory on the server, and I don't know how to make that work.
Yes you have to save the file to the server. You can do that with cfdocument. Then you have to call it using the full path.
If you're efficient, you'll use variables for the filename, including the path.
This is different than uploading files. Google <cfdocument> and you'll get the correct page from the cfml reference manual. Look at all the attributes and see what they do.
If you are using CF 8.0.1 you should be able to use the content attribute of cfmailparam to attach a cfdocument PDF variable to a mail message without having to save your PDF to the file system. See the 8.0.1 release notes page 7 for new features of cfmail.
Thanks to both of you for your suggestions. I was able to make the form generate a PDF and send it. The last question I have now is how to delete the resulting PDF. I looked at the PDF you linked and it makes sense, but looking at livedocs, I don't see a remove parameter in the cfmail and cfmailparam pages.
I don't know if the server I am hosting this on is using 8 or 7 so if someone could point me to the old way to do it, I would be most appreciative.
you delete files with cffile tag.
since you are sending this file as attachment, you should set
spoolenable="no" in your cfmail tag so that your email is sent
immediately instead of going to the mail spool first - otherwise if you
delete the attached file your email will fail... or you won;t be able to
delete the file...