- $fp = fopen($attachment_dir . $tmpDraftFile, 'w');
-
- $headerlength = write822HeaderForDraft ($fp, $t, $c, $b, $subject, $more_headers, FALSE);
- $bodylength = writeBodyForDraft ($fp, $body, FALSE);
- fclose($fp);
-
- $length = ($headerlength + $bodylength);
-
- if (sqimap_mailbox_exists ($imap_stream, $draft_folder)) {
- sqimap_append ($imap_stream, $draft_folder, $length);
- write822HeaderForDraft ($imap_stream, $t, $c, $b, $subject, $more_headers, TRUE);
- writeBodyForDraft ($imap_stream, $body, TRUE);
- sqimap_append_done ($imap_stream);
- }
- sqimap_logout($imap_stream);
- if ($length)
- ClearAttachments();
- if (file_exists($attachment_dir . $tmpDraftFile) )
- unlink ($attachment_dir . $tmpDraftFile);
- return $length;
+ $full_tmpDraftFile = "$hashed_attachment_dir/$tmpDraftFile";
+ }
+ $fp = fopen($full_tmpDraftFile, 'w');
+
+ $headerlength = write822HeaderForDraft
+ ($fp, $t, $c, $b, $subject, $more_headers, FALSE);
+ $bodylength = writeBodyForDraft ($fp, $body, FALSE);
+ fclose($fp);
+
+ $length = ($headerlength + $bodylength);
+
+ if (sqimap_mailbox_exists ($imap_stream, $draft_folder)) {
+ sqimap_append ($imap_stream, $draft_folder, $length);
+ write822HeaderForDraft
+ ($imap_stream, $t, $c, $b, $subject, $more_headers, TRUE);
+ writeBodyForDraft ($imap_stream, $body, TRUE);
+ sqimap_append_done ($imap_stream);
+ }
+ sqimap_logout($imap_stream);
+ if ($length){
+ ClearAttachments();
+ }
+ if (file_exists($full_tmpDraftFile)){
+ unlink ($full_tmpDraftFile);
+ }
+ return $length;