|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Deleting Attachments Immediately After CFMAIL
Author: Nathan Wells
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:54028#302741
It looks like this has been addressed in ColdFusion 8.0.1; from the release
notes: "The cfmail and cfmailparam tags now have a remove attribute that tells
ColdFusion to
remove any attachments after successful mail delivery."
Complete release notes:
http://www.adobe.com/support/documentation/en/coldfusion/801/cf801releasenotes.pdf
----- Excess quoted text cut - see Original Post for more -----
Jochem
Author: Daniel Roberts
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:54028#292186
How about keep a list of email attachments that need to be deleted. This could be
in application or server scope. After an email is spooled up, add the attachement
to the list or array. Have a scheduled task look through your spool folder every
so often and if the attachment isn't in any of the spool file it is safe to
delete.
Author: Jochem van Dieten
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:54028#292146
Dan G. Switzer, II wrote:
> I went ahead and blogged an fully working example using the technique Jon
> Wolski pointed out on Charlie Arehart's blog:
>
> http://blog.pengoworks.com/blogger/index.cfm?action=blog:610
>
> My example also shows using embedded images in an HTML message.
Unfortunately your example produces messages that will not result in the
desired rendering on conforming MUAs. Your attachments should be on the
outermost MIME part, not nested somewhere in the middle. I.e, you have:
multipart/alternative
multipart/mixed
HTML
txt
pdf
img (attachment)
img (inline)
application/unsupported
It should be:
multipart/mixed
multipart/alternative
multipart/related
HTML
img (inline)
txt
pdf
img (attachment)
In Thunderbird I see a message with 4 attachments for your example.
Jochem
Author: Dan G. Switzer, II
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:54028#292125
Nathan,
>Thanks a lot for the references. They both look very promising for our
>needs. Our applications don't send that many emails, but I knew I wasn't
>the first one to run into problems like this. You saved me some time
>searching in the dark.
I went ahead and blogged an fully working example using the technique Jon
Wolski pointed out on Charlie Arehart's blog:
http://blog.pengoworks.com/blogger/index.cfm?action=blog:610
My example also shows using embedded images in an HTML message.
-Dan
Author: Jochem van Dieten
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:54028#292113
Nathan Wells wrote:
> Does anybody know how attachments work in CF 8?
Same as in 7.
> Has anyone heard of future plans by Adobe to allow attached files to be
automatically deleted after the spool file has been processed. Maybe something
similar to the <cfcontent> tag?
> <cfmailparam file="#theFullFilePath#" delete="yes">
I like that idea. Did you submit it? http://www.adobe.com/go/wish/
> And finally, has anyone ever tried to somehow force the contents of the file
into the body of the email so it is indeed written to the spool file?
I couldn't get it to work with the CF mail spool. It is pretty easy to
use another mail spool or Javamail.
Jochem
Author: Nathan Wells
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:54028#292100
----- Excess quoted text cut - see Original Post for more -----
Dan,
Thanks a lot for the references. They both look very promising for our needs.
Our applications don't send that many emails, but I knew I wasn't the first one
to run into problems like this. You saved me some time searching in the dark.
Nathan
Author: Ben Doom
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:54028#292095
Without having tried it, the first thing that springs to mind is to turn
off mail spooling.
In theory, attaching files should not be that much of a bother. I think
you have to add a header specifying filename, MIME header, etc., and you
have to add the file as a base-64 encoded block at the end of the email.
Others (Jochem -- I'm looking at you!) could probably advise better
about this.
HTH
--Ben Doom
Nathan Wells wrote:
----- Excess quoted text cut - see Original Post for more -----
Author: Dan G. Switzer, II
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:54028#292093
Nathan,
----- Excess quoted text cut - see Original Post for more -----
Adobe did this to speed up mass e-mailings that all use a common set of
attachments--which is common when doing bulk mailings. Obviously in this
case there's considerably less disk space used and does speed things up.
However, when you're trying to send dynamically generated content it's a
real PITA.
Here's a blog entry I wrote a while back which shows how the JavaMail API
can be used directly to send SMTP without needing to write attachments to
disk:
http://blog.pengoworks.com/blogger/index.cfm?action=blog:584
There's also this blog entry over at Charlie Arehart's site which discusses
some alternatives (see the comments):
http://carehart.org/blog/client/index.cfm/2007/1/13/cfdocument_name_attribut
e
-Dan
Author: Nathan Wells
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:54028#292090
Is there any way to safely delete files that were attached using a
<cfmailparam> tag to an email that was generated with the <cfmail>
tag? If you delete the attached file too soon, then the file doesn't get
attached to the email, at best, and at worst, the email fails altogether.
<cfmail to="me@here.com" to="you@there.com" subject="See Attachment">
<cfmailparam file="#theFullFilePath#">
See attached file, #GetFileFromPath(theFullFilePath)#
</cfmail>
<cffile action="delete" file="#theFullFilePath#">
I know for a fact that this worked just fine in CF 5, because the contents of the
attached file would be included as a base64 string in the .mail file that was
written to the spool. In the MX versions of CF, only path of the attached file
is put in the .mail file, meaning the attached file had to stick around until the
.mail file in the spool could be processed.
It seems like a significant feature digression, but I have found zero
documentation on this from Adobe. It is quite a hindrance if you are attaching
(gasp) dynamically generated files to emails to create an entire separate process
to manually clean up the files from the file system.
Does anybody know how attachments work in CF 8? I haven't tried it yet, and I
would be curious if it works the same as CF 7.
Has anyone heard of future plans by Adobe to allow attached files to be
automatically deleted after the spool file has been processed. Maybe something
similar to the <cfcontent> tag?
<cfmailparam file="#theFullFilePath#" delete="yes">
And finally, has anyone ever tried to somehow force the contents of the file into
the body of the email so it is indeed written to the spool file?
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||