From ec2e713ecba5adaf67e2988682cf25e95c071be5 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 27 Jun 2020 10:23:45 +0200 Subject: [PATCH] Fix problem with forwarding inline images attached to messages with no HTML part (#7414) --- CHANGELOG | 1 + program/steps/mail/compose.inc | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index cfab02465..cb8bc52f4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -33,6 +33,7 @@ CHANGELOG Roundcube Webmail - Increase maximum size of contact jobtitle and department fields to 128 characters - Fix missing newline after the logged line when writing to stdout (#7418) - Elastic: Fix context menu (paste) on the recipient input (#7431) +- Fix problem with forwarding inline images attached to messages with no HTML part (#7414) RELEASE 1.4.6 ------------- diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 387b5d653..5b54e984b 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -947,6 +947,8 @@ function rcmail_write_compose_attachments(&$message, $bodyIsHtml, &$message_body $loaded_attachments[$attachment['name'] . $attachment['mimetype']] = $attachment; } + $has_html = $message->has_html_part(); + foreach ((array) $message->mime_parts() as $pid => $part) { if ($part->mimetype == 'message/rfc822') { $messages[] = $part->mime_id; @@ -984,7 +986,8 @@ function rcmail_write_compose_attachments(&$message, $bodyIsHtml, &$message_body // Skip inline images when not used in the body // Note: Apple Mail sends PDF files marked as inline (#7382) - if ($part->disposition == 'inline' && $part->mimetype != 'application/pdf') { + // Note: Apple clients send inline images even if there's no HTML body (#7414) + if ($has_html && $part->disposition == 'inline' && $part->mimetype != 'application/pdf') { if (!$bodyIsHtml) { continue; }