954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Coldfusion Beginners

I was concerned about how threads can be used in Coldfusion. Actually I am using 'cfmail' tag to send a mail with an attachment and I am storing the attachment file in a directory. What happens to be in the code is that, After using the cfmail tag I am deleting the directory. When I check the mail for the attachments it is not there. I think the mail could not be sent before the directory is deleted. Mail could not be sent prior to directory deletion. PLease comment !

sharma.rahul375
Newbie Poster
4 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
 
I think the mail could not be sent before the directory is deleted.

No, not if you're using spooling. With spooling mail is sent via a separate thread and may be sent after you delete the file. If you read the docs on cfmail that's the expected behavior (see below). If you're on 8.0.1+, a better option is to use instead. http://livedocs.adobe.com/coldfusion/8/Tags_m-o_01.html
Note: The cfmail tag does not make copies of attachments when spooling mail to disk. If you use the cfmail tag to send a message with an attachment with spooling enabled and you use the cffile tag to delete the attachment file, ColdFusion might not send the mail because the mailing process might execute after the file was deleted. ....

arrgh
Posting Whiz
381 posts since Dec 2008
Reputation Points: 32
Solved Threads: 47
 

Hi arrgh,
Thanks for your comment ! I am posting my code for your better understanding. Have a look

#HTMLEditFormat(arguments.message)#

I am checking if any attachment exists then only the loop will iterate through the attachments and I am also using cfmailparam tag. Your comment awaited !

sharma.rahul375
Newbie Poster
4 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
 

You need to read the file content into a variable. Then use content="...">. Then it won't matter if you delete the file.
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7c15.html

arrgh
Posting Whiz
381 posts since Dec 2008
Reputation Points: 32
Solved Threads: 47
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You