Skip to content

Commit

Permalink
fix(backend): ensure attachments are sent along when forwarding an em…
Browse files Browse the repository at this point in the history
…ail (#1407)
  • Loading branch information
mercihabam authored Dec 19, 2024
1 parent b593a0e commit b768681
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions modules/smtp/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ public function process() {
if (array_key_exists(0, $msg_struct) && array_key_exists('subs', $msg_struct[0])) {
foreach ($msg_struct[0]['subs'] as $ind => $sub) {
if ($ind != '0.1') {
$new_attachment['basename'] = $sub['description'];
$new_attachment['name'] = $sub['description'];
$new_attachment['basename'] = $sub['attributes']['name'];
$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 = $this->config->get('attachment_dir') . DIRECTORY_SEPARATOR . md5($this->session->get('username', false)) . DIRECTORY_SEPARATOR . $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 Expand Up @@ -134,15 +134,16 @@ public function process() {
if (array_key_exists(0, $msg_struct) && array_key_exists('subs', $msg_struct[0])) {
foreach ($msg_struct[0]['subs'] as $ind => $sub) {
if ($ind != '0.1') {
$new_attachment['basename'] = $sub['description'];
$new_attachment['name'] = $sub['description'];
$new_attachment['basename'] = $sub['attributes']['name'];;
$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 = $this->config->get('attachment_dir') . DIRECTORY_SEPARATOR . md5($this->session->get('username', false)) . DIRECTORY_SEPARATOR . $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;
$new_attachment['filename'] = $file_path;
$new_attachement['sub'] = json_encode($sub);
$attached_files[$this->request->get['uid']][] = $new_attachment;
}
}
Expand Down

0 comments on commit b768681

Please sign in to comment.