From 9d95de032d2ca0faf9dd1ecb282d308c9629fba7 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Sun, 26 Mar 2017 17:39:49 +0200 Subject: [PATCH] mail message: multipart/alternative: avoid choosing the text/plain part if it is empty (yes it happens...) --- src/internfile/mh_mail.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/internfile/mh_mail.cpp b/src/internfile/mh_mail.cpp index 34df1057..2970e38e 100644 --- a/src/internfile/mh_mail.cpp +++ b/src/internfile/mh_mail.cpp @@ -465,12 +465,13 @@ void MimeHandlerMail::walkmime(Binc::MimePart* doc, int depth) else if (!stringlowercmp("text/html", content_type.value)) ithtml = it; } - if (ittxt != doc->members.end()) { - LOGDEB2("walkmime: alternative: chose text/plain part\n"); - walkmime(&(*ittxt), depth); + if (ittxt != doc->members.end() && ittxt->bodylength) { + LOGDEB2("walkmime: alternative: choose text/plain. Size: " << + ittxt->bodylength << endl); + walkmime(&(*ittxt), depth); } else if (ithtml != doc->members.end()) { - LOGDEB2("walkmime: alternative: chose text/html part\n"); - walkmime(&(*ithtml), depth); + LOGDEB2("walkmime: alternative: choose text/html.\n"); + walkmime(&(*ithtml), depth); } } return;