def _parse_email_headers(self, parsed_mail, part, charset=None, add_email_id=None):
    email_header_artifacts = parsed_mail[PROC_EMAIL_JSON_EMAIL_HEADERS]
    email_headers = part.items()
    if (not email_headers):
        return 0
    headers = self._get_email_headers_from_part(part, charset)
    cef_artifact = {}
    cef_types = {}
    if headers.get('From'):
        emails = headers['From']
        if emails:
            cef_artifact.update({'fromEmail': emails})
    if headers.get('To'):
        emails = headers['To']
        if emails:
            cef_artifact.update({'toEmail': emails})
    message_id = headers.get('Message-ID')
    if ((not cef_artifact) and (not message_id)):
        return 0
    cef_types.update({'fromEmail': ['email'], 'toEmail': ['email']})
    if headers:
        cef_artifact['emailHeaders'] = headers
    if add_email_id:
        cef_artifact['emailId'] = add_email_id
        if self._email_id_contains:
            cef_types.update({'emailId': self._email_id_contains})
    artifact = {}
    artifact.update(_artifact_common)
    artifact['name'] = 'Email Artifact'
    artifact['cef'] = cef_artifact
    artifact['cef_types'] = cef_types
    email_header_artifacts.append(artifact)
    return len(email_header_artifacts)
def _parse_email_headers(self, parsed_mail, part, charset=None, add_email_id=None):
    email_header_artifacts = parsed_mail[PROC_EMAIL_JSON_EMAIL_HEADERS]
    email_headers = part.items()
    if (not email_headers):
        return 0
    headers = self._get_email_headers_from_part(part, charset)
    cef_artifact = {}
    cef_types = {}
    if headers.get('From'):
        emails = headers['From']
        if emails:
            cef_artifact.update({'fromEmail': emails})
    if headers.get('To'):
        emails = headers['To']
        if emails:
            cef_artifact.update({'toEmail': emails})
    message_id = headers.get('Message-ID')
    if ((not cef_artifact) and (not message_id)):
        return 0
    cef_types.update({'fromEmail': ['email'], 'toEmail': ['email']})
    if headers:
        cef_artifact['emailHeaders'] = headers
    if add_email_id:
        cef_artifact['emailId'] = add_email_id
        if self._email_id_contains:
            cef_types.update({'emailId': self._email_id_contains})
    artifact = {}
    artifact.update(_artifact_common)
    artifact['name'] = 'Email Artifact'
    artifact['cef'] = cef_artifact
    artifact['cef_types'] = cef_types
    email_header_artifacts.append(artifact)
    return len(email_header_artifacts)