Solved

CFMAIL PDF documnet as email attachments

Posted on 2007-12-06
5
1,213 Views
Last Modified: 2012-08-13
I am generating a pdf using cfdocument. Once I have create the pdf's I want to able to attach them to the cfmail code. I also want to over write the PDF's when a new on is created.

<cfdocument
overwrite = "yes"
format="pdf"
pagetype="letter"
marginleft=".5"
marginright=".5"
margintop=".5"
marginbottom=".5">
<cfinclude template="cle_cert.cfm">
</cfdocument>
0
Comment
Question by:smares323
5 Comments
 
LVL 18

Expert Comment

by:Plucka
ID: 20424743
Get CFDOCUMENT to write the PDF to a file then you can just use <CFMAIL

and the mimeattach = "path" attribute

with the ouput file. The overwrite attribute will replace it each time.
0
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
ID: 20425582
Here's the syntax..

<cfmail from = "peter@domain.com" To = "paul@domain.com"
            Subject = "See Important Attachments and Reply">

  Please read the attached PDF file and let us know what
  you think.

  <cfmailparam file = "c:\work\mydocument.pdf">
</cfmail>

Be aware that you should not allow the file to be deleted or replaced too quickly.  After running the CFMAIL tag, the email is placed in the spooler and may take 10 or 15 seconds before going out.  The PDF file attachment must exist for that period of time or the email will error and not go out.   Also, if you overwrite the file during that period, you will send out the new PDF file with the old email.

0
 

Author Comment

by:smares323
ID: 20428858
do I have include the mimeattach = "path" attribute whith in cfmail tag.
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 20429186
you can use either approach, the mimeattach or the cfmailparam
0
 
LVL 1

Expert Comment

by:chair9design
ID: 23143668
Is it possible to know if the email has been sent/cleared from the CFMAIL spool  and use that as a trigger to know when it's okay to delete the file from the server?

For example...once an email finally sent after waiting in the mail queue it could send a response to a script that would take the file attachment name from the email that was just sent and then delete the file at that time. to keep there from being a build up of pdfs?

Sorry to re-open an old thread, but I was curious if it was possible to have any input/clarification on knowing when it's safe to delete the file.

Thanks a lot!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now