From ec0fc4679948cae148e3f0084e6a20b12c159956 Mon Sep 17 00:00:00 2001 From: nbm Date: Mon, 23 Jan 2006 15:25:44 +0000 Subject: [PATCH] Use the storage manager to get a copy of the file to add as an attachment in the email being sent. --- plugins/ktstandard/KTEmail.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/ktstandard/KTEmail.php b/plugins/ktstandard/KTEmail.php index c263a4f..cb6e06a 100644 --- a/plugins/ktstandard/KTEmail.php +++ b/plugins/ktstandard/KTEmail.php @@ -107,9 +107,18 @@ function sendEmailDocument($sDestEmailAddress, $sDestUserName, $iDocumentID, $sD $sTitle = "Document: " . $sDocumentName . " from " . $oSendingUser->getName(); $oEmail = new Email(); $oDocument = Document::get($iDocumentID); - $sDocumentPath = $oDocument->getPath(); + + // Request a standard file path so that it can be attached to the + // email + $oStorage =& KTStorageManagerUtil::getSingleton(); + $sDocumentPath = $oStorage->temporaryFile($oDocument); + $sDocumentFileName = $oDocument->getFileName(); $res = $oEmail->sendAttachment($sDestEmailAddress, $sTitle, $sMessage, $sDocumentPath, $sDocumentFileName); + + // Tell the storage we don't need the temporary file anymore. + $oStorage->freeTemporaryFile($sDocumentPath); + if (PEAR::isError($res)) { $default->log->error($res->getMessage()); $aEmailErrors[] = $res->getMessage(); -- libgit2 0.21.4