From: Ali Alnubani Date: Wed, 11 Jan 2023 04:49:11 +0000 (+0200) Subject: Bug 1657496: correctly handle MIME type on single-part email (#126) X-Git-Tag: bugzilla-5.3.3~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f82dde7c0f3ffbe29a435d5d10dcdeeb3c024857;p=thirdparty%2Fbugzilla.git Bug 1657496: correctly handle MIME type on single-part email (#126) Backported from 6765ab04774eebf8ea0bd063566240b24ac28f15. --- diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm index 8bf94b2648..0dd9d7e45a 100644 --- a/Bugzilla/Mailer.pm +++ b/Bugzilla/Mailer.pm @@ -77,10 +77,10 @@ sub generate_email { } my $email = Bugzilla::MIME->new($msg_header); - if (scalar(@parts) == 1) { - $email->content_type_set($parts[0]->content_type); - } - else { + + # If there's only one part, we don't need to set the overall content type + # because Email::MIME will automatically take it from that part (bug 1657496) + if (scalar(@parts) > 1) { $email->content_type_set('multipart/alternative'); # Some mail clients need same encoding for each part, even empty ones.