def extract_data(file_name):
    file = open(file_name)
    email_text = file.readlines()

    subject = import_email.get_subject(email_text)
    date = import_email.get_date(email_text)
    body = import_email.get_content(email_text)

    sender_email = import_email.get_from(email_text)
    to_addresses = import_email.get_to(email_text)

    cc_addresses = import_email.get_cc(email_text)

    bcc_addresses = import_email.get_bcc(email_text)

    return {
        "subject": subject,
        "date": date,
        "body": body,
        "from": sender_email,
        "to": to_addresses,
        "cc": cc_addresses,
        "bcc": bcc_addresses
    }
Beispiel #2
0
 def test_get_from_None(self):
     self.assertEqual(import_email.get_from(test_inputs.get_non_email_text()), None)
Beispiel #3
0
 def test_get_from(self):
     self.assertEqual(import_email.get_from(test_inputs.get_valid_email_text()), '*****@*****.**')