def extract_msg_headers(self, entity, msg):
    'Parse E-Mail headers into FtM properties.'
    try:
        entity.add('indexText', msg.values())
    except Exception as ex:
        log.warning('Cannot parse all headers: %r', ex)
    entity.add('subject', self.get_header(msg, 'Subject'))
    entity.add('date', self.get_dates(msg, 'Date'))
    entity.add('mimeType', self.get_header(msg, 'Content-Type'))
    entity.add('threadTopic', self.get_header(msg, 'Thread-Topic'))
    entity.add('generator', self.get_header(msg, 'X-Mailer'))
    entity.add('language', self.get_header(msg, 'Content-Language'))
    entity.add('keywords', self.get_header(msg, 'Keywords'))
    entity.add('summary', self.get_header(msg, 'Comments'))
    message_id = self.get_header(msg, 'Message-ID')
    entity.add('messageId', self.parse_message_ids(message_id))
    references = self.get_header(msg, 'References')
    in_reply_to = self.get_header(msg, 'In-Reply-To')
    entity.add('inReplyTo', self.parse_references(references, in_reply_to))
    return_path = self.get_header_identities(msg, 'Return-Path')
    self.apply_identities(entity, return_path)
    reply_to = self.get_header_identities(msg, 'Reply-To')
    self.apply_identities(entity, reply_to)
    sender = self.get_header_identities(msg, 'Sender', 'X-Sender')
    self.apply_identities(entity, sender, 'emitters', 'sender')
    froms = self.get_header_identities(msg, 'From', 'X-From')
    self.apply_identities(entity, froms, 'emitters', 'from')
    tos = self.get_header_identities(msg, 'To', 'Resent-To')
    self.apply_identities(entity, tos, 'recipients', 'to')
    ccs = self.get_header_identities(msg, 'CC', 'Cc', 'Resent-Cc')
    self.apply_identities(entity, ccs, 'recipients', 'cc')
    bccs = self.get_header_identities(msg, 'Bcc', 'BCC', 'Resent-Bcc')
    self.apply_identities(entity, bccs, 'recipients', 'bcc')
Parse E-Mail headers into FtM properties.
def extract_msg_headers(self, entity, msg):
    
    try:
        entity.add('indexText', msg.values())
    except Exception as ex:
        log.warning('Cannot parse all headers: %r', ex)
    entity.add('subject', self.get_header(msg, 'Subject'))
    entity.add('date', self.get_dates(msg, 'Date'))
    entity.add('mimeType', self.get_header(msg, 'Content-Type'))
    entity.add('threadTopic', self.get_header(msg, 'Thread-Topic'))
    entity.add('generator', self.get_header(msg, 'X-Mailer'))
    entity.add('language', self.get_header(msg, 'Content-Language'))
    entity.add('keywords', self.get_header(msg, 'Keywords'))
    entity.add('summary', self.get_header(msg, 'Comments'))
    message_id = self.get_header(msg, 'Message-ID')
    entity.add('messageId', self.parse_message_ids(message_id))
    references = self.get_header(msg, 'References')
    in_reply_to = self.get_header(msg, 'In-Reply-To')
    entity.add('inReplyTo', self.parse_references(references, in_reply_to))
    return_path = self.get_header_identities(msg, 'Return-Path')
    self.apply_identities(entity, return_path)
    reply_to = self.get_header_identities(msg, 'Reply-To')
    self.apply_identities(entity, reply_to)
    sender = self.get_header_identities(msg, 'Sender', 'X-Sender')
    self.apply_identities(entity, sender, 'emitters', 'sender')
    froms = self.get_header_identities(msg, 'From', 'X-From')
    self.apply_identities(entity, froms, 'emitters', 'from')
    tos = self.get_header_identities(msg, 'To', 'Resent-To')
    self.apply_identities(entity, tos, 'recipients', 'to')
    ccs = self.get_header_identities(msg, 'CC', 'Cc', 'Resent-Cc')
    self.apply_identities(entity, ccs, 'recipients', 'cc')
    bccs = self.get_header_identities(msg, 'Bcc', 'BCC', 'Resent-Bcc')
    self.apply_identities(entity, bccs, 'recipients', 'bcc')