diff --git a/README.rst b/README.rst index 2a0e8c2d..ee292438 100644 --- a/README.rst +++ b/README.rst @@ -58,7 +58,7 @@ describes an email, using the following schema: "from": "email", "subject": "string", "body": "html", - "attachments": [{"filename": "string", "content": "base64", "id": "string"}] + "attachments": [{"filename": "string", "content": "base64", "cid": "string"}] } ----------------- diff --git a/opwen_email_server/utils/email_parser.py b/opwen_email_server/utils/email_parser.py index dc66f21d..79d9477b 100644 --- a/opwen_email_server/utils/email_parser.py +++ b/opwen_email_server/utils/email_parser.py @@ -45,7 +45,7 @@ def _parse_attachments(mailparts: Iterable[MailPart]) -> Iterable[dict]: if filename and payload: attachment = {'filename': filename, 'content': payload} if attachment_id: - attachment['id'] = attachment_id + attachment['cid'] = attachment_id yield attachment diff --git a/tests/opwen_email_server/utils/test_email_parser.py b/tests/opwen_email_server/utils/test_email_parser.py index f5171040..c3b283ff 100644 --- a/tests/opwen_email_server/utils/test_email_parser.py +++ b/tests/opwen_email_server/utils/test_email_parser.py @@ -75,9 +75,9 @@ def test_cid(self): attachments = email.get('attachments', []) self.assertEqual(len(attachments), 2) - self.assertIsNotNone(attachments[0].get('id')) - self.assertIsNotNone(attachments[1].get('id')) - self.assertNotEqual(attachments[0]['id'], attachments[1]['id']) + self.assertIsNotNone(attachments[0].get('cid')) + self.assertIsNotNone(attachments[1].get('cid')) + self.assertNotEqual(attachments[0]['cid'], attachments[1]['cid']) @classmethod def _given_mime_email(cls, filename, directory=TEST_DATA_DIRECTORY):