summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2014-10-01 17:29:49 -0300
committerDuda Dornelles <ddornell@thoughtworks.com>2014-10-01 17:30:03 -0300
commit1b936ef4deb233c97035e845b044954355da8d33 (patch)
treeedeee7ddf8eda36f0b9b16ff227860b6001efdf9 /service
parentaa04ff3742e53bff9f5369ab7357050b7c2947a3 (diff)
Fixing recipients in PixelatedMail#as_dict
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/adapter/pixelated_mail.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/service/pixelated/adapter/pixelated_mail.py b/service/pixelated/adapter/pixelated_mail.py
index 2f13cb01..c6c8681d 100644
--- a/service/pixelated/adapter/pixelated_mail.py
+++ b/service/pixelated/adapter/pixelated_mail.py
@@ -170,9 +170,19 @@ class PixelatedMail:
@property
def headers(self):
- _headers = ['From', 'To', 'Subject', 'Cc', 'Bcc']
- _headers = {header: self.hdoc.content['headers'].get(header) for header in _headers}
+ _headers = {}
+
+ for header in ['To', 'Cc', 'Bcc']:
+ header_value = self.hdoc.content['headers'].get(header)
+ if not header_value:
+ continue
+ _headers[header] = header_value if type(header_value) is list else header_value.split(', ')
+
+ for header in ['From', 'Subject']:
+ _headers[header] = self.hdoc.content['headers'].get(header)
+
_headers['Date'] = self._get_date()
+
return _headers
def _get_date(self):