summaryrefslogtreecommitdiff
path: root/src/jwebmail/render_mail.py
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2023-12-08 13:01:13 +0100
committerJannis M. Hoffmann <jannis@fehcom.de>2023-12-08 13:01:13 +0100
commita00292129478a2b38673fd39cd361c7142166d4d (patch)
tree739ee64df9acc249f7a1efcd9c3ba1f31726ff30 /src/jwebmail/render_mail.py
parentd08bc4fd1dab191db5ee01e81509c9b9b33c710d (diff)
get header fields as optional
Diffstat (limited to 'src/jwebmail/render_mail.py')
-rw-r--r--src/jwebmail/render_mail.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/jwebmail/render_mail.py b/src/jwebmail/render_mail.py
index 804b200..588959c 100644
--- a/src/jwebmail/render_mail.py
+++ b/src/jwebmail/render_mail.py
@@ -114,10 +114,10 @@ def render_message(subtype, msg, path):
R += '<dl class="jwm-mail-header">'
R += f"<dt>{escape(gettext('Subject'))}</dt>"
R += f"<dd>{escape(msg['head']['subject'])}</dd>\n"
- R += _format_header(gettext("From"), msg["head"]["from"])
- R += _format_header(gettext("To"), msg["head"]["to"])
- R += _format_header(gettext("CC"), msg["head"]["cc"])
- R += _format_header(gettext("BCC"), msg["head"]["bcc"])
+ R += _format_header(gettext("From"), msg["head"].get("from"))
+ R += _format_header(gettext("To"), msg["head"].get("to"))
+ R += _format_header(gettext("CC"), msg["head"].get("cc"))
+ R += _format_header(gettext("BCC"), msg["head"].get("bcc"))
R += f"<dt>{escape(gettext('Date'))}</dt>"
R += f"<dd>{escape(msg['head']['date'])}</dd>\n"
R += f"<dt>{escape(gettext('Content-Type'))}</dt>"