How to  delete email attachments from server

Hi,
I created an a CF template for sending e-mail which includes
attachments. It has been tested on my dev box and is functioning
fine as the attachment upload to a designated directory on the
server. I would like the attachments to be purged once the e-mail
has been forwarded to the recipent.
In Macromedia's ColdFuision 7MX web application construction
book page 913 "Interacting with Email" there is a CFC that will
delete the file when the user ends their session.
I am not sure how to write this to fit the code I am using.
Here is the eMail form
<!--- Mail_Form.cfm--->
<html>
<head>
<title>Please enter your message</title>
</head>
<body>
<form action="Send_Email.cfm" method="post"
enctype="multipart/form-data">
<table width="500" border="0" align="center">
<tr>
<td width = "500" colspan="2">Please enter your e-mail
message:</td>
</tr>
<tr>
<td width="250">To:</td>
<td width="250"><input type="text" name="to_addr"
value=""></td>
</tr>
<tr>
<td>Subject:</td>
<td><input type="text" name="subject"
value=""></td>
</tr>
<tr>
<td>Message:</td>
<td><input textarea name="message" rows="5"
cols="35"></textarea></td>
</tr>
<tr>
<td width="250">Attachment #1:</td>
<td width="250"><input type="file"
name="attachment_1" value=""></td>
</tr>
<tr>
<td width="250">Attachment #2:</td>
<td width="250"><input type="file"
name="attachment_2" value=""></td>
</tr>
<tr>
<td width="250">Attachment #3:</td>
<td width="250"><input type="file"
name="attachment_3" value=""></td>
</tr>
<tr>
<td width="250"> </td>
<td width="250"><input type="submit"
name="Send_Email" value="SendEmail"></td>
</tr>
</table>
</form>
Here is the form to send the attachment.
<!--- Send_Email.cfm --->
<!--- First make sure that the user uploaded attachments
--->
<cfif FORM.attachment_1 neq "">
<!--- first actually upload the file --->
<cffile action="upload"
destination="D:\uploadsTEST\"
filefield="attachment_1"
nameconflict="makeunique">
<!--- now create a temporary holder for the attachment
later on --->
<cfset attachment_local_file_1 =
"d:\uploadsTEST\#file.serverfile#">
</cfif>
<!---Now repeat the process for the second and third
attachment:--->
<cfif FORM.attachment_2 neq "">
<!--- first actually upload the file --->
<cffile action="upload"
destination="D:\uploadsTEST\"
filefield="attachment_2"
nameconflict="makeunique">
<!--- now create a temporary holder for the attachment
later on --->
<cfset attachment_local_file_2 =
"d\uploadsTEST\#file.serverfile#">
</cfif>
<cfif FORM.attachment_3 neq "">
<!--- forst actually upload the file --->
<cffile action="upload"
destination="D:\uploadsTEST\"
filefield="attachment_3"
nameconflict="makeunique">
<!--- now create a temporary holder for the attachment
late on --->
<cfset attachment_local_file_3 =
"d:\uploadsTEST\#file.serverfile#">
</cfif>
<!---OK, you have now uploaded the file the server, now
let's send
out the email with the attachments:--->
<cfmail FROM="[email protected]" to="#form.to_addr#"
subject="#subject#"
server="an001so-dby1c.pbi.global.pvt" port="25">
#message#
<cfsilent>
<!--- <cfsilent> tag used to kill the white space
in this area
so your email is not cluttered with white space.--->
<cfif FORM.attachment_1 neq "">
<cfmailparam file="#attachment_local_file_1#">
</cfif>
<cfif FORM.attachment_2 neq "">
<cfmailparam file="#attachment_local_file_2#">
</cfif>
<cfif FORM.attachment_3 neq "">
<cfmailparam file="#attachment_local_file_3#">
</cfif>
</cfsilent>
</cfmail>
Here is the session application code to delete the file upon
uploading
<!---
Filename: Application.cfc
Executes for every page request
--->
<cfcomponent output="false">
<!--- Name the application. --->
<cfset this.name="attachmentPurge">
<!--- Turn on session management. --->
<cfset this.sessionManagement=true>
<cfset this.clientMangment=true>
<cffunction name="onSessionEnd" output="false"
returnType="void">
<!--- Look for attachments to delete --->
<cfset var attachDir = expandPath("Attach")>
<cfset var getFiles = "">
<cfset var thisFile = "">
<!--- Get a list of all files in the directory --->
<cfdirectory directory="#attachDir#" name="getFiles">
<!--- For each file in the directory --->
<cfloop query="getFiles">
<!--- If it's a file (rather than a directory) --->
<cfif getFiles.type neq "Dir">
<!--- Get full filename of this file --->
<cfset thisFile =
expandPath("Attach\#getFiles.Name#")>
</cfif>
</cfloop>
</cffunction>
</cfcomponent>
The tutorial only explains how to delete the attachment when
the recipient checks there mail
in the POP server.
Assuming that the sender is in a session would the code be
written to delete the attached file from the directory on
the server one the e-mail is sent.
Can someone explain how to automatically delete email
attachments from a designated directory or provide me with the code
that would handle this after an email is sent with attachment.
Thanks,
Tony

I don't know why your dos code didn't run. It could be
addressing. My limited experience with cfdirectory/cffile/cfexecute
is to type out the complete path at least once.
Good books?
Hard to say, depends on what else you are new at. If you are
new to html, then htmlgoodies.com has good tutorials. So does
webmonkey.com. If you have trouble with sql, I have heard good
things about the SAMS book, Teach Yourself SQL in 10 Minutes by Ben
Forta. I learned javascript by buying the book Teach Yourself
Javascript in 24 Hours. The O'Reilly books are also good. I learned
awk with one of those books.
Glad you liked the fish pics. The camera is specified on most
of the pages. If it says Reefmaster, I used an external strobe. If
it says Sony I either used the camera flash only or natural light.
By the way, that is not a Cold Fusion site. It's strictly html and
javascript.

Similar Messages

  • How to delete SMS attachments from IOS 6.0

    Does anyone know how to delete SMS attachments from the iPhone - They are still located on the phone after the messages associated with them have been deleted.  I am sure that previous versions of IOS deleted the attachment when the message was deleted.
    The issue being for me is that the phone is now getting cluttered with unwanted phot

    You need to "void the warranty" and then buy iExplorer or a similar program, and THEN you can access the SMS library to delete them.   Apple admits this problem yet hasn't bothered to fix it.   Those SMS attachments should have been deleted all along, but they were being stored in an inaccessible location.  Thus, Apple's customers are unable to fix Apple's mistake; meanwhile, our iphones' space is being minimized because of Apple's bug.

  • How to delete email only from iphone 4s

    How can I delete email from my iphone but not from my hotmail account?

    Not possible with an IMAP or Exchange account.
    If you are accessing your Hotmail account as a POP account with the iPhone's Mail app, deleting a received email from your iPhone should have no effect on the server. Not sure if Microsoft supports accessing a Hotmail account as a POP account.

  • How to delete the files from server through OAF page

    Hi All,
    I have a requirement in which i am creating files on server through my CO code.
    Now once the page is rendered, i want to delete the files from the server.
    Just wondering how can we achieve this.
    Kindly advice!
    Thanks,
    Sachin

    Hi Sachin
    all the methods in the processRequest() are called during loading of the page.
    all the methods in the processFormRequest() are called during any action events on the page.
    So Use the method in processFormRequest() : write a method in
    that on which action you want to delete the file.
    regards
    sridhar

  • How to delete email address from blackberry 8530

    does anyone know how to delete old users email address from my phone and add my email address

    Hello,
    I think you have bigger problems. With a 2nd hand device, there are specific steps to take:
    KB05099 Steps to take before selling or after buying a previously owned BlackBerry smartphone
    I think you need to contact the former owner and have them perform their steps. Only then should you attempt your steps.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How to delete eMail attachments without deleting the text

    Often people reply to eMails that I have sent and the resend all the attachments. So maybe I've sent 10 photos and this is 2mb in size. They reply - often more than once - and the attachments are all there!
    With Eudora, I could simply go to the Eudora Folder and delete the attachments to save HD Space (hey, 2mb a few times per day for a few years is a lot of gb!)
    How to do that in Mail - but without deleting the text of the message they sent?
    Thanks for any reply here--

    YES!! THANKS VERY MUCH! And now there must must must be a way to alter incoming eMail text and then save that without forwarding or whatever.
    By the way - I have found my Mail INBOX for my POP and also for my MobileMe accounts (as well as the other mailboxes). In my Library/Mail folder. OK so my INBOX for my POP is 800mb in size. Let's imagine that I have 8000 messages and 200 of them have attachments that are 1 to 10mb in size. If I now select all the messages in the INBOX and delete the attachments, will I see that INBOX drop substantially in size? And those attachments are "glued" to each eMail, right? I can't see them other than opening each eMail and then if I want to save the attachment(s) somewhere, doing that manually, right?
    Is there a way to have all attachments automatically saved in another folder? But then they likely are not linked to an eMail - so if I then delete the attachment that is linked to the eMail, the attachment I saved to another folder is there OK- but it is no longer associated with the eMail, so I might not know to what it is related at some future time.
    There were some nice advantages to Eudora-- you could quickly scan your attachments in coverflow or other mode--
    Mail's way has some advantages in that you always have the attachment linked AND you can save another copy easily.
    Likely best to archive each 31 Dec and then have INBOX-2009-21-31 and next year INBOX-2010-12-31 -- I did that with Eudora and have every message received and sent (most with attachments - but that's a bit tricky) - since 5 March 1996. Handy that.
    OK I'm rambling a bit but let me know if I have it right here.
    And thanks!

  • Deleting email messages from server and device

    I had to wipe my 8830 due to a major sync problem but I no longer have the option to delete from the server when I delete email messages. I checked the user's guide and throughout my device. Where do I find this setting please?

    Ok, here is the Knowledge Base article relating to your need.
    http://www.blackberry.com/btsc/KB13509
     From your MESSAGES folder > Menu > Options > Email Reconciliation > Message Services.
    If those settings are not present on your device... you probably have some Service Book problems (as in not present or corrupt).
    Do this: First, look at Options > Advanced > Servcie Books and delete ALL service books releated to any email account.
    Then, with the BlackBerry device powered ON, remove the battery a few seconds and then reinsert the battery to reboot
     Then do this:
    1. Options > Advanced > Host Routing Table > Menu > Register.
    2. Resend your service books from your carrier BIS site.
    http://www.blackberryfaq.com/index.php/Where_can_I​_log_into_my_BIS_account%3F
    3. With the BlackBerry device powered ON, remove the battery a few seconds and then reinsert the battery to reboot
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Deleting email messages from server

    I have set my (POP3) mail box to delete messages from its server immediately on download. But messages are not being deleted from the server. Any ideas as to why this should be?
    Thanks
    Andy

    Ok, here is the Knowledge Base article relating to your need.
    http://www.blackberry.com/btsc/KB13509
     From your MESSAGES folder > Menu > Options > Email Reconciliation > Message Services.
    If those settings are not present on your device... you probably have some Service Book problems (as in not present or corrupt).
    Do this: First, look at Options > Advanced > Servcie Books and delete ALL service books releated to any email account.
    Then, with the BlackBerry device powered ON, remove the battery a few seconds and then reinsert the battery to reboot
     Then do this:
    1. Options > Advanced > Host Routing Table > Menu > Register.
    2. Resend your service books from your carrier BIS site.
    http://www.blackberryfaq.com/index.php/Where_can_I​_log_into_my_BIS_account%3F
    3. With the BlackBerry device powered ON, remove the battery a few seconds and then reinsert the battery to reboot
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How to delete email addresses from address book(?)

    I want to clean-up/purge my address book of old/obsolete addresses. What I've been doing is deleting entries within each address, but that creates as many "no name" entries as the ones deleted. Is there a way to delete unwanted email addresses? Thanks.
    Pete ((The Oldfella)

    I don't understand the question... In particular, I'm not sure what you mean about how deleting e-mail addresses creates "no name entries". If you want to delete a contact, simply select it and choose Edit -> Delete Card (or just hit the delete key). If you want to remove an e-mail address while leaving the contact, select the contact, click the Edit button and then click the red '-' button next to the e-mail address.

  • TS3276 how to delete email address from history?

    In MS Outlook, an emal account can be deleted when viewing the history of sent to email accounts. Possible in Mail?

    Within Mail.app, select Window from the menu > select Previous Recipients > slash and burn entries as appropriate.
    If the entries are from the Address Book / Contacts, you'll need to remove the entry over in that tool.

  • How to delete emails permanently (from your hard drive)

    Hi there,
    I've been reading up a lot, but I did not find anything convincing, hence my post. I hope I can find some help here.
    I've been using mail with gmail (IMAP) for a couple of months, before switching to TBird. I've deleted my account in Mail, but for some reason, my emails remain accessible, for instance when I use spotlight. there is a folder mail in users/library/mail that seems to have all my emails (2.3gb which is also pretty much the size of my gmail account).
    can I safely delete the contents of this folder? Will it impair my ability to re-create a gmail account in mail, if needed?
    Best,
    Seb

    that folder should have been deleted when you deleted the gmail account. you can trash it by hand. it's safe to do so.

  • How to delete emails on all devices simultaneously

    Cannot find the answer to my question and probably won't be able to ask using the correct terminology, but...
    I have a mac laptop, iphone, and ipad as well as a mobile me account. I also have three email accounts set up on each of these devices through the mail application (me.com, hotmail, and gmail)
    I am trying to figure out how to delete emails simultaneously from all devices when I delete it on one device. For example: I delete an email I read on my ipad from my hotmail account and want it it disappear from the inbox on my iphone and laptop. As it is now I have to delete messages separately from all devices... meaning I have to waste time reviewing messages I have already decided to throw away.
    Can anyone offer help on how to accomplish this.
    Thanks,
    Jason

    Actually, Yahoo is Imap (as is google).  but the point remains - if you are using a pop account, you need to delete the mail from each device.(pop is basically a one way system).  If you have an imap account, changes you make of one device are communicated to all your other devices.

  • How to delete EMAIL accounts

    I am using Nokia E72. could you please suggest how to delete EMAIL accounts from Mobile

    If the accounts have been set up with Nokia Messaging, then go to email.nokia.com, log in there with the details of the first account you set up, and then you can delete accounts you don't need.
    Once done when the phone next syncs it will remove them from the phone.
    If they are manually configured accounts, then on the phone, just go to Email->Settings-> scroll to the account -> Options -> Remove mailbox
    E72-1 UK CV 052.005

  • Delete email receipients from autocompletion

    Can you tell me how to delete email recipients from autocompletion. This is very problematic as I have unwanted emails in here.

    How bad do you want it? I found the only way to do this is to go to settings (General, Reset) and then to Reset all Content and Settings. Then when you restore, you must do as a new iPhone, not from a backup (because of course those same address are in the backup). You lose everything. As long as you have your contacts, calendars, bookmarks, etc... inputted in your computer, when you re-sync you just put it back. Although you will have to re-do things such as customized home screens, and the arrangement of bookmarks. And any SMS's will be deleted too.

  • I have an imap account and deleted all mail from server. Once doing this all emails from my iPad -which was on a wi-fi- where automatically deleted. Fortunately these emails are still visible on my iPhone that was without connection. If I send all these e

    I have an imap account and deleted all mail from server. Once doing this all emails from my iPad -which was on a wi-fi- where automatically deleted. Fortunately these emails are still visible on my iPhone that was without connection. If I send all these emails to my iCloud account - they will remain into my outgoing folder until I open my wi-fi- …BUT will they be sent when I open my wi-fi connection, or since they are no longer on my server… be deleted for ever!?

    This is how IMAP works, if you delete from one device it will also be deleted in the other devices.
    iCloud do not backup e-mails.

Maybe you are looking for