From 256753cd3264de5ad6ec748cf43d24ac86bcadf2 Mon Sep 17 00:00:00 2001 From: Bojan Mihelac Date: Fri, 17 May 2013 13:41:29 +0200 Subject: [PATCH] Add Content-ID header for attachments images can be referenced in message body by attachment title: --- emencia/django/newsletter/mailer.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emencia/django/newsletter/mailer.py b/emencia/django/newsletter/mailer.py index 0bbcf96..ab2f955 100644 --- a/emencia/django/newsletter/mailer.py +++ b/emencia/django/newsletter/mailer.py @@ -140,6 +140,9 @@ def build_attachments(self): message_attachment.set_payload(fd.read()) encode_base64(message_attachment) fd.close() + if attachment.title: + message_attachment.add_header('Content-ID', + "<%s>" % attachment.title) message_attachment.add_header('Content-Disposition', 'attachment', filename=attachment.title) attachments.append(message_attachment)