Another alternative, if you are using CF 8 and above, is the content attribute of the cfmailparam tag. You can use this to attache the binary data itself as an attachment, that way you do not have to rely on a file existing on the server at the time the mail is sent. Read the file into a variable and then add it to the content attribute and delete the file. I am actually saving the file contents into the database, and then dropping the value of the database column directly into the cfmailparam tag. It has been working great, and no need for file clean up.
Ben Nadel has a great blog about it. http://www.bennadel.com/blog/1220-ColdFusion-CFMailParam-s-New-Content-Attribute-Is-Awesome.htm Brian Cain On Wed, Oct 23, 2013 at 8:08 AM, Steve LaBadie <slaba...@po-box.esu.edu>wrote: > > I have a web-based form that requires the user to upload a document. > Everything works fine until I try and delete the document after delivery. > With the delete action enabled the email does not get delivered. I have > place the action=delete inside and outside of the </cfmail> > > <cfif isDefined("form.attached") AND form.attached NEQ ""> > <cffile action="upload" > destination="f:\inetpub\wwwroot\......\......\upload" mode="644" > nameConflict="overwrite" fileField="form.attached"> > <cfset > attachment="f:\inetpub\wwwroot\......\......\upload\#cffile.serverFile#"> > </cfif> > <cfprocessingdirective suppresswhitespace="no"> > <cfmail from="#......#" to="#......#" subject="" > type="html"> > <cfsilent><cfif FORM.attached neq > ""><cfmailparam file="#attachment#" /></cfif></cfsilent> > </cfmail> > > <cfif isDefined("form.attached") AND form.attached NEQ ""> > <cffile action="Delete" file="#attachment#"> > </cfif> > > Steve LaBadie, Web Manager > East Stroudsburg University > 570-422-3999 > slaba...@esu.edu<mailto:slaba...@esu.edu> > > [facebook-16x16]<http://www.facebook.com/eaststroudsburguniversity> > [twitter-16x16] <http://twitter.com/esuniversity> [youtube-16x16] < > http://www.youtube.com/user/esuedu> > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356966 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm