Beispiel #1
0
    def _index_mail(self, writer, mail):
        mdict = mail.as_dict()
        header = mdict['header']
        tags = mdict.get('tags', [])
        tags.append(mail.mailbox_name.lower())
        bounced = mail.bounced if mail.bounced else ['']

        index_data = {
            'sender': self._unicode_header_field(header.get('from', '')),
            'subject': self._unicode_header_field(header.get('subject', '')),
            'date': milliseconds(header.get('date', '')),
            'to':
            u','.join([h.decode('utf-8') for h in header.get('to', [''])]),
            'cc':
            u','.join([h.decode('utf-8') for h in header.get('cc', [''])]),
            'bcc':
            u','.join([h.decode('utf-8') for h in header.get('bcc', [''])]),
            'tag': u','.join(unique(tags)),
            'bounced': u','.join(bounced),
            'body': unicode(mdict['textPlainBody']),
            'ident': unicode(mdict['ident']),
            'flags': unicode(','.join(unique(mail.flags))),
            'raw': unicode(mail.raw.decode('utf-8'))
        }

        writer.update_document(**index_data)
Beispiel #2
0
    def _index_mail(self, writer, mail):
        mdict = mail.as_dict()
        header = mdict['header']
        tags = mdict.get('tags', [])
        tags.append(mail.mailbox_name.lower())
        index_data = {
            'sender': unicode(header.get('from', '')),
            'subject': unicode(header.get('subject', '')),
            'date': milliseconds(header.get('date', '')),
            'to': unicode(header.get('to', '')),
            'cc': unicode(header.get('cc', '')),
            'bcc': unicode(header.get('bcc', '')),
            'tag': u','.join(unique(tags)),
            'body': unicode(mdict['body']),
            'ident': unicode(mdict['ident']),
            'flags': unicode(','.join(unique(mail.flags))),
            'raw': unicode(mail.raw)
        }

        writer.update_document(**index_data)
    def _index_mail(self, writer, mail):
        mdict = mail.as_dict()
        header = mdict['header']
        tags = mdict.get('tags', [])
        tags.append(mail.mailbox_name.lower())
        index_data = {
            'sender': unicode(header.get('from', '')),
            'subject': unicode(header.get('subject', '')),
            'date': milliseconds(header.get('date', '')),
            'to': u','.join(header.get('to', [''])),
            'cc': u','.join(header.get('cc', [''])),
            'bcc': u','.join(header.get('bcc', [''])),
            'tag': u','.join(unique(tags)),
            'body': unicode(mdict['body']),
            'ident': unicode(mdict['ident']),
            'flags': unicode(','.join(unique(mail.flags))),
            'raw': unicode(mail.raw)
        }

        writer.update_document(**index_data)
    def _index_mail(self, writer, mail):
        mdict = mail.as_dict()
        header = mdict["header"]
        tags = set(mdict.get("tags", {}))
        tags.add(mail.mailbox_name.lower())
        bounced = mail.bounced if mail.bounced else [""]

        index_data = {
            "sender": self._empty_string_to_none(header.get("from", "")),
            "subject": self._empty_string_to_none(header.get("subject", "")),
            "date": milliseconds(header.get("date", "")),
            "to": self._format_recipient(header, "to"),
            "cc": self._format_recipient(header, "cc"),
            "bcc": self._format_recipient(header, "bcc"),
            "tag": u",".join(unique(tags)),
            "bounced": u",".join(bounced),
            "body": unicode(mdict["textPlainBody"] if "textPlainBody" in mdict else mdict["body"]),
            "ident": unicode(mdict["ident"]),
            "flags": unicode(",".join(unique(mail.flags))),
            "raw": unicode(mail.raw),
        }

        writer.update_document(**index_data)
Beispiel #5
0
    def _index_mail(self, writer, mail):
        mdict = mail.as_dict()
        header = mdict['header']
        tags = set(mdict.get('tags', {}))
        tags.add(mail.mailbox_name.lower())
        bounced = mail.bounced if mail.bounced else ['']

        index_data = {
            'sender': self._unicode_header_field(header.get('from', '')),
            'subject': self._unicode_header_field(header.get('subject', '')),
            'date': milliseconds(header.get('date', '')),
            'to': self._format_recipient(header, 'to'),
            'cc': self._format_recipient(header, 'cc'),
            'bcc': self._format_recipient(header, 'bcc'),
            'tag': u','.join(unique(tags)),
            'bounced': u','.join(bounced),
            'body': unicode(mdict['textPlainBody'] if 'textPlainBody' in mdict else mdict['body']),
            'ident': unicode(mdict['ident']),
            'flags': unicode(','.join(unique(mail.flags))),
            'raw': unicode(mail.raw)
        }

        writer.update_document(**index_data)
    def _index_mail(self, writer, mail):
        mdict = mail.as_dict()
        header = mdict['header']
        tags = mdict.get('tags', [])
        tags.append(mail.mailbox_name.lower())
        bounced = mail.bounced if mail.bounced else ['']

        index_data = {
            'sender': self._unicode_header_field(header.get('from', '')),
            'subject': self._unicode_header_field(header.get('subject', '')),
            'date': milliseconds(header.get('date', '')),
            'to': u','.join([h.decode('utf-8') for h in header.get('to', [''])]),
            'cc': u','.join([h.decode('utf-8') for h in header.get('cc', [''])]),
            'bcc': u','.join([h.decode('utf-8') for h in header.get('bcc', [''])]),
            'tag': u','.join(unique(tags)),
            'bounced': u','.join(bounced),
            'body': unicode(mdict['textPlainBody']),
            'ident': unicode(mdict['ident']),
            'flags': unicode(','.join(unique(mail.flags))),
            'raw': unicode(mail.raw.decode('utf-8'))
        }

        writer.update_document(**index_data)