Skip to content

Commit

Permalink
Merge pull request #841 from josaphatim/fixed-attachments-on-forward
Browse files Browse the repository at this point in the history
Fixed attachments not forwarded with emails
  • Loading branch information
kroky authored Dec 14, 2023
2 parents 0433117 + e58ee84 commit 8b72c57
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions modules/smtp/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,17 @@ public function process() {
$attached_files = [];
$this->session->set('uploaded_files', array());
if (array_key_exists(0, $msg_struct) && array_key_exists('subs', $msg_struct[0])) {
$file_dir = $this->config->get('attachment_dir') . DIRECTORY_SEPARATOR . md5($this->session->get('username', false)) . DIRECTORY_SEPARATOR;
if (!is_dir($file_dir)) {
mkdir($file_dir);
}
foreach ($msg_struct[0]['subs'] as $ind => $sub) {
if ($ind != '0.1') {
$new_attachment['basename'] = $sub['description'];
$new_attachment['name'] = $sub['description'];
$new_attachment['name'] = $sub['attributes']['name'];
$new_attachment['size'] = $sub['size'];
$new_attachment['type'] = $sub['type'];
$file_path = $this->config->get('attachment_dir') . DIRECTORY_SEPARATOR . $new_attachment['name'];
$file_path = $file_dir . $new_attachment['name'];
$content = Hm_Crypt::ciphertext($imap->get_message_content($this->request->get['uid'], $ind), Hm_Request_Key::generate());
file_put_contents($file_path, $content);
$new_attachment['tmp_name'] = $file_path;
Expand Down

0 comments on commit 8b72c57

Please sign in to comment.