| | |
| | | $related_part = $p; |
| | | else if ($sub_mimetype == 'text/plain' && !$plain_part) |
| | | $plain_part = $p; |
| | | else if ($sub_mimetype == 'text/html' && !$html_part) |
| | | else if ($sub_mimetype == 'text/html' && !$html_part) { |
| | | $html_part = $p; |
| | | $this->got_html_part = true; |
| | | } |
| | | else if ($sub_mimetype == 'text/enriched' && !$enriched_part) |
| | | $enriched_part = $p; |
| | | else { |
| | |
| | | $p->ctype_secondary = 'plain'; |
| | | $p->mimetype = 'text/plain'; |
| | | $p->realtype = 'multipart/encrypted'; |
| | | $p->mime_id = $structure->mime_id; |
| | | |
| | | $this->parts[] = $p; |
| | | |
| | | // add encrypted payload part as attachment |
| | | if (is_array($structure->parts)) { |
| | | for ($i=0; $i < count($structure->parts); $i++) { |
| | | $subpart = $structure->parts[$i]; |
| | | if ($subpart->mimetype == 'application/octet-stream' || !empty($subpart->filename)) { |
| | | $this->attachments[] = $subpart; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // this is an S/MIME ecrypted message -> create a plaintext body with the according message |
| | | else if ($mimetype == 'application/pkcs7-mime') { |
| | |
| | | $p->ctype_secondary = 'plain'; |
| | | $p->mimetype = 'text/plain'; |
| | | $p->realtype = 'application/pkcs7-mime'; |
| | | $p->mime_id = $structure->mime_id; |
| | | |
| | | $this->parts[] = $p; |
| | | |
| | | if (!empty($structure->filename)) { |
| | | $this->attachments[] = $structure; |
| | | } |
| | | } |
| | | // message contains multiple parts |
| | | else if (is_array($structure->parts) && !empty($structure->parts)) { |
| | |
| | | continue; |
| | | |
| | | if ($part_mimetype == 'text/html' && $mail_part->size) { |
| | | $got_html_part = true; |
| | | $this->got_html_part = true; |
| | | } |
| | | |
| | | $mail_part = $plugin['structure']; |
| | |
| | | else if ($mail_part->mimetype == 'message/rfc822') { |
| | | $this->parse_structure($mail_part); |
| | | } |
| | | // calendar part not marked as attachment (#1490325) |
| | | else if ($part_mimetype == 'text/calendar') { |
| | | if (!$mail_part->filename) { |
| | | $mail_part->filename = 'calendar.ics'; |
| | | } |
| | | |
| | | $this->attachments[] = $mail_part; |
| | | } |
| | | } |
| | | |
| | | // if this was a related part try to resolve references |
| | |
| | | // MS Outlook sends sometimes non-related attachments as related |
| | | // In this case multipart/related message has only one text part |
| | | // We'll add all such attachments to the attachments list |
| | | if (!isset($got_html_part) && empty($inline_object->content_id)) { |
| | | if (!isset($this->got_html_part)) { |
| | | $this->attachments[] = $inline_object; |
| | | } |
| | | // MS Outlook sometimes also adds non-image attachments as related |