mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-28 06:28:43 +01:00
Ticket #45.
This commit is contained in:
@@ -349,8 +349,8 @@ class ImapListing(EmailListing):
|
||||
self.mbc.criterions = ["(%s)" % criterions]
|
||||
|
||||
class ImapEmail(Email):
|
||||
def __init__(self, msg, addrfull=False, **kwargs):
|
||||
Email.__init__(self, msg, **kwargs)
|
||||
def __init__(self, msg, addrfull=False, *args, **kwargs):
|
||||
Email.__init__(self, msg, *args, **kwargs)
|
||||
|
||||
fields = ["Subject", "From", "To", "Reply-To", "Cc", "Date"]
|
||||
for f in fields:
|
||||
@@ -371,3 +371,16 @@ class ImapEmail(Email):
|
||||
except:
|
||||
pass
|
||||
|
||||
def render_headers(self, **kwargs):
|
||||
attachments = []
|
||||
for part in self.attachments:
|
||||
decoded = decode_header(part.get_filename())
|
||||
if decoded[0][1] is None:
|
||||
attachments += [decoded[0][0]]
|
||||
else:
|
||||
attachments += [unicode(decoded[0][0], decoded[0][1])]
|
||||
return render_to_string("webmail/headers.html", {
|
||||
"headers" : self.headers,
|
||||
"folder" : kwargs["folder"], "mail_id" : kwargs["mail_id"],
|
||||
"attachments" : attachments != [] and attachments or None
|
||||
})
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{% extends "common/mailheaders.html" %}
|
||||
{% load i18n %}
|
||||
<table id="emailheaders">
|
||||
{% for hdr in headers %}
|
||||
<tr><th width="130px">{{ hdr.name }}</th><td>{{ hdr.value }}</td></tr>
|
||||
{% endfor %}
|
||||
{% if attachments %}
|
||||
|
||||
{% block extraheaders %}
|
||||
{% if attachments %}
|
||||
<tr>
|
||||
<th>{% trans "Attachments" %}</th>
|
||||
<td>
|
||||
@@ -13,5 +12,5 @@
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user