cleanups for mail template

workspace
Brendan Howell 4 years ago
parent 6535ac33bf
commit 756482724d

@ -19,12 +19,13 @@
width: 70%; width: 70%;
min-height: 12em; min-height: 12em;
padding-right: 3%; padding-right: 3%;
line-height: 0.9em; line-height: 1.2em;
} }
#menu { #menu {
font-family: "CMU Sans Serif";
width: 24%; width: 24%;
float: left; float: left;
padding-right: 3%; /* padding-right: 3%; */
} }
.cmd { .cmd {
clear: both; clear: both;
@ -38,9 +39,11 @@
<div id="container"> <div id="container">
<div id="header"> <div id="header">
<div class="env-info">From: ${msg.fromstr}</div> <div class="env-info">From: ${msg.fromstr}</div>
% if msg.cc:
<div class="env-info">CC: ${msg.cc}</div> <div class="env-info">CC: ${msg.cc}</div>
% endif
<div class="env-info">Subject: ${msg.subject}</div> <div class="env-info">Subject: ${msg.subject}</div>
<div class="env-info">Date: ${msg.date}</div> <div class="env-info">Date: ${msg.date.strftime("%A, %d. %B %Y %H:%M")}</div>
<div class="env-info">To: ${msg.tostr}</div> <div class="env-info">To: ${msg.tostr}</div>
</div> </div>
<div id="main"> <div id="main">

@ -104,7 +104,7 @@ class MailRoom(Bureau):
""" """
#TODO: consider replacing this whole mess with #TODO: consider replacing this whole mess with
# https://pypi.python.org/pypi/mail-parser # https://pypi.python.org/pypi/mail-parser
internaldate = resp_obj[b'INTERNALDATE'] internaldate = resp_obj[imap_id][b'INTERNALDATE']
msg_data = resp_obj[imap_id][b'RFC822'].decode('utf-8') msg_data = resp_obj[imap_id][b'RFC822'].decode('utf-8')
msg_obj = email.message_from_string(msg_data, msg_obj = email.message_from_string(msg_data,
@ -128,6 +128,9 @@ class MailRoom(Bureau):
msg.content = msg.content.get_content() msg.content = msg.content.get_content()
else: else:
msg.content = "ERROR COULD NOT FIND EMAIL BODY!\n Big shrug." msg.content = "ERROR COULD NOT FIND EMAIL BODY!\n Big shrug."
msg.content = msg.content.replace("<", "&lt;")
msg.content = msg.content.replace(">", "&gt;")
msg.content = msg.content.replace("\n", "<br />")
# extract other sub-messages / attachments # extract other sub-messages / attachments
#for part in msg_obj.walk(): #for part in msg_obj.walk():

Loading…
Cancel
Save