diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2015-02-23 16:50:10 -0300 |
---|---|---|
committer | Victor Shyba <victor.shyba@gmail.com> | 2015-02-23 16:50:10 -0300 |
commit | b967397c20e216b3e2d34926765ee5c6e5fcb8c3 (patch) | |
tree | 1b0248bbc739508016dc8ed63f9b54b84ebdedd2 /service/pixelated | |
parent | c37c3b425021eb485376b8b776c248afb2a9b2a6 (diff) |
for #174, mailer daemon is now filtered from suggestions
Diffstat (limited to 'service/pixelated')
-rw-r--r-- | service/pixelated/adapter/model/mail.py | 4 | ||||
-rw-r--r-- | service/pixelated/adapter/search/__init__.py | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/service/pixelated/adapter/model/mail.py b/service/pixelated/adapter/model/mail.py index 3ea7c95a..96f2c81c 100644 --- a/service/pixelated/adapter/model/mail.py +++ b/service/pixelated/adapter/model/mail.py @@ -384,7 +384,9 @@ class PixelatedMail(Mail): def bounced(self): content_type = self.hdoc.content["headers"].get("Content-Type", '') if re.compile('delivery-status').search(content_type): - return self._extract_bounced_address(self.hdoc.content) + bounce_recipient = self._extract_bounced_address(self.hdoc.content) + bounce_daemon = self.headers["From"] + return [bounce_recipient, bounce_daemon] if bounce_recipient else False return False diff --git a/service/pixelated/adapter/search/__init__.py b/service/pixelated/adapter/search/__init__.py index e9301278..0b1a1034 100644 --- a/service/pixelated/adapter/search/__init__.py +++ b/service/pixelated/adapter/search/__init__.py @@ -124,6 +124,7 @@ class SearchEngine(object): header = mdict['header'] tags = mdict.get('tags', []) tags.append(mail.mailbox_name.lower()) + bounced = mail.bounced if mail.bounced else [''] index_data = { 'sender': unicode(header.get('from', '')), 'subject': unicode(header.get('subject', '')), @@ -132,7 +133,7 @@ class SearchEngine(object): 'cc': u','.join(header.get('cc', [''])), 'bcc': u','.join(header.get('bcc', [''])), 'tag': u','.join(unique(tags)), - 'bounced': unicode(mail.bounced), + 'bounced': u','.join(bounced), 'body': unicode(mdict['textPlainBody']), 'ident': unicode(mdict['ident']), 'flags': unicode(','.join(unique(mail.flags))), |