Hello,
I have a system that is uploading a file and sending the file as an attachment to an email. This is working perfectly. What I would like to do is delete the file after it has been attached. I tried adding the code in the Email_Sending Server Event after the Attachment code but that did not work. I tried adding the code in the Row_Updated Server Event but that didn’t work either. In either instance the file is being deleted before the email is sent. Is there someplace I can add the code that will delete this file from the server but only after it has been attached to the email?
Hello,
Thanks for the response. Below is the code I am using. The issue is that the file deletes properly but before it is attached. I need it to delete after it is attached.
If ($rsnew[‘MyImage’]<>“”){
$source=“MyImages/” . $rsnew[‘MyImage’] . “”;
unlink($source);
}
I have added this code to the following places;
Server Events > Row Updated (When edited)
Server Events > Row Inserted (When added)
Server Events > Email Sending (After the code that attaches image to the email, just before return TRUE;)
In any of the above scenarios the file is not attached but it is deleted.
I need to be able to delete it after it has been attached to the email and the email has been sent.