diff --git a/kanmail/client/components/emails/ThreadMessage.jsx b/kanmail/client/components/emails/ThreadMessage.jsx
index 7e5dd063..a151ce97 100644
--- a/kanmail/client/components/emails/ThreadMessage.jsx
+++ b/kanmail/client/components/emails/ThreadMessage.jsx
@@ -6,6 +6,7 @@ import { openLink } from 'window.js';
import Avatar from 'components/Avatar.jsx';
import ThreadMessageAttachment from 'components/emails/ThreadMessageAttachment.jsx';
+import threadStore from 'stores/thread.js';
import { ensureInView } from 'util/element.js';
import { cleanHtml } from 'util/html.js';
@@ -364,6 +365,15 @@ export default class ThreadMessage extends React.Component {
uid,
} = this.props.message;
+ if (body.error) {
+ return
;
+ }
+
let html = body.html || body.text;
if (this.state.showPlainText) {
html = body.text;
diff --git a/kanmail/client/stores/thread.js b/kanmail/client/stores/thread.js
index 6885a41f..f9b69333 100644
--- a/kanmail/client/stores/thread.js
+++ b/kanmail/client/stores/thread.js
@@ -206,6 +206,10 @@ class ThreadStore extends BaseStore {
});
}
+ reloadThread() {
+ this.loadThread(this.props.thread);
+ }
+
close(triggerUpdate=true) {
if (!this.isOpen) {
return;
diff --git a/kanmail/server/mail/__init__.py b/kanmail/server/mail/__init__.py
index 6914e659..3c078f8c 100644
--- a/kanmail/server/mail/__init__.py
+++ b/kanmail/server/mail/__init__.py
@@ -164,9 +164,14 @@ def get_folder_email_texts(account_key, folder_name, uids):
uid_to_html_part_number = {}
uid_to_headers = folder.get_email_headers(uids)
+ uid_to_error = {}
for uid in uids:
- headers = uid_to_headers[uid]
+ headers = uid_to_headers.get(uid)
+
+ if not headers:
+ uid_to_error[uid] = 'Missing headers'
+ continue
uid_to_allow_images[uid] = all(
is_email_allowed_images(email)
@@ -192,6 +197,8 @@ def get_folder_email_texts(account_key, folder_name, uids):
if text:
uid_parts.append((uid, text))
uid_to_text_part_number[uid] = text
+ else:
+ uid_to_error[uid] = 'No text or HTML content'
uid_part_data = _get_folder_email_parts(account_key, folder_name, uid_parts)
@@ -213,6 +220,12 @@ def get_folder_email_texts(account_key, folder_name, uids):
'text': text_data,
'html': html_data,
}
+
+ for uid, error in uid_to_error.items():
+ uid_part_data_with_cids[uid] = {
+ 'error': error,
+ }
+
return uid_part_data_with_cids