summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alot/db/message.py14
-rw-r--r--alot/widgets/thread.py3
2 files changed, 14 insertions, 3 deletions
diff --git a/alot/db/message.py b/alot/db/message.py
index 731b4e1f..c4ea5f8a 100644
--- a/alot/db/message.py
+++ b/alot/db/message.py
@@ -18,6 +18,11 @@ from ..settings.const import settings
charset.add_charset('utf-8', charset.QP, charset.QP, 'utf-8')
+MISSING_HTML_MSG = ("This message contains a text/html part that was not "
+ "rendered due to a missing mailcap entry. "
+ "Please refer to item 5 in our FAQ: "
+ "http://alot.rtfd.io/en/latest/faq.html")
+
@functools.total_ordering
class Message(object):
@@ -256,7 +261,14 @@ class Message(object):
returns bodystring extracted from this mail
"""
# TODO: allow toggle commands to decide which part is considered body
- return extract_body(self.get_email())
+ eml = self.get_email()
+ bodytext = extract_body(eml)
+
+ # check if extracted body is empty but msg contains html parts
+ if (not bodytext and
+ 'text/html' in (part.get_content_type() for part in eml.walk())):
+ return MISSING_HTML_MSG
+ return bodytext
def get_text_content(self):
return extract_body(self.get_email(), types=['text/plain'])
diff --git a/alot/widgets/thread.py b/alot/widgets/thread.py
index 5b2a55f3..396cdf92 100644
--- a/alot/widgets/thread.py
+++ b/alot/widgets/thread.py
@@ -14,7 +14,6 @@ from .globals import TagWidget
from .globals import AttachmentWidget
from ..settings.const import settings
from ..db.utils import decode_header, X_SIGNATURE_MESSAGE_HEADER
-from ..db.utils import extract_body
class MessageSummaryWidget(urwid.WidgetWrap):
@@ -238,7 +237,7 @@ class MessageTree(CollapsibleTree):
def _get_body(self):
if self._bodytree is None:
- bodytxt = extract_body(self._message.get_email())
+ bodytxt = self._message.accumulate_body()
if bodytxt:
att = settings.get_theming_attribute('thread', 'body')
att_focus = settings.get_theming_attribute(