diff options
-rw-r--r-- | service/pixelated/adapter/pixelated_mail.py | 14 |
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): |