diff --git a/email_service_client/client/resources.py b/email_service_client/client/resources.py index 1b4037c..6f940af 100644 --- a/email_service_client/client/resources.py +++ b/email_service_client/client/resources.py @@ -76,9 +76,10 @@ def create(self, data: OutgoingEmailRequestPayload) -> List[OutgoingEmailRequest ("subject", data["subject"]), ("body", data["body"]), ("html", data["html"]), - ("amp", data["amp"]), *[("attachments", attachment) for attachment in data["attachments"]], ] + if "amp" in data: + form_data.append(("amp", data["amp"])) encoded_data = requests_toolbelt.MultipartEncoder(fields=form_data) return self._session.post( self.resource_url, diff --git a/email_service_client/tests/unit_tests/email_identity_resource_tests.py b/email_service_client/tests/unit_tests/email_identity_resource_tests.py index 9f1f751..2cde9f2 100644 --- a/email_service_client/tests/unit_tests/email_identity_resource_tests.py +++ b/email_service_client/tests/unit_tests/email_identity_resource_tests.py @@ -109,7 +109,7 @@ def test_create(self, multipart_encoder_patch): data={ "from_name": "John", "from_address": "john@coengagage.com", - "recipients": [("jane@plivo.com")], + "recipients": ["jane@plivo.com", "kane@plivo.com"], "subject": "test", "body": "hello!", "amp": "", @@ -127,6 +127,7 @@ def test_create(self, multipart_encoder_patch): fields=[ ("from_address", "john@coengagage.com"), ("recipients", "jane@plivo.com"), + ("recipients", "kane@plivo.com"), ("reply_to", "mridula@coengagedev.com"), ("subject", "test"), ("body", "hello!"),