diff --git a/src/html.rs b/src/html.rs index 1379f10eb..b7cd121ee 100644 --- a/src/html.rs +++ b/src/html.rs @@ -108,9 +108,12 @@ impl HtmlMsgParser { /// Function iterates over all mime-parts /// and searches for text/plain and text/html parts and saves the - /// last one found + /// first one found. /// in the corresponding structure fields. - /// Usually, there is at most one plain-text and one HTML-text part. + /// + /// Usually, there is at most one plain-text and one HTML-text part, + /// multiple plain-text parts might be used for mailinglist-footers, + /// therefore we use the first one. fn collect_texts_recursive<'a>( &'a mut self, context: &'a Context, @@ -135,12 +138,11 @@ impl HtmlMsgParser { } MimeMultipartType::Single => { let mimetype = mail.ctype.mimetype.parse::()?; - if mimetype == mime::TEXT_HTML { + if mimetype == mime::TEXT_HTML && self.html.is_empty() { if let Ok(decoded_data) = mail.get_body() { self.html = decoded_data; - return Ok(()); } - } else if mimetype == mime::TEXT_PLAIN { + } else if mimetype == mime::TEXT_PLAIN && self.plain.is_none() { if let Ok(decoded_data) = mail.get_body() { self.plain = Some(PlainText { text: decoded_data, @@ -155,7 +157,6 @@ impl HtmlMsgParser { false }, }); - return Ok(()); } } Ok(())