From e72e8ab515931f294523e836693eb76358fed240 Mon Sep 17 00:00:00 2001 From: Patrick Maia Date: Thu, 23 Oct 2014 19:15:03 -0300 Subject: Card #30 - handles alternative bodies on InputMail --- service/pixelated/adapter/mail.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'service/pixelated/adapter') diff --git a/service/pixelated/adapter/mail.py b/service/pixelated/adapter/mail.py index f21ed2ef..fdfeda89 100644 --- a/service/pixelated/adapter/mail.py +++ b/service/pixelated/adapter/mail.py @@ -155,7 +155,11 @@ class InputMail(Mail): mime_multipart['Subject'] = self.headers['Subject'] mime_multipart['Date'] = self.headers['Date'] - mime_multipart.attach(MIMEText(self.body, 'plain')) + if type(self.body) is list: + for part in self.body: + mime_multipart.attach(MIMEText(part['raw'], part['content-type'])) + else: + mime_multipart.attach(MIMEText(self.body, 'plain')) return mime_multipart def to_smtp_format(self): -- cgit v1.2.3