diff --git a/backend/inspirehep/mailing/providers/mailtrain.py b/backend/inspirehep/mailing/providers/mailtrain.py index ee70ca66cb..db417eced2 100644 --- a/backend/inspirehep/mailing/providers/mailtrain.py +++ b/backend/inspirehep/mailing/providers/mailtrain.py @@ -23,7 +23,12 @@ def mailtrain_subscribe_user_to_list(list_id, email, first_name, last_name): last_name (str): user last name. """ LOGGER.info("Adding user to the mailing list.", list_id=list_id, email=email) - data = {"FIRST_NAME": first_name, "LAST_NAME": last_name, "EMAIL": email} + data = { + "FIRST_NAME": first_name, + "LAST_NAME": last_name, + "EMAIL": email, + "FORCE_SUBSCRIBE": "yes", + } response = requests.post( f"{current_app.config.get('MAILTRAIN_URL')}/api/subscribe/{list_id}", params={"access_token": current_app.config.get("MAILTRAIN_API_TOKEN")}, diff --git a/backend/tests/integration/mailing/cassettes/test_mailtrain_subscribe_user_to_list.yaml b/backend/tests/integration/mailing/cassettes/test_mailtrain_subscribe_user_to_list.yaml index f9e361261e..ba9e9b8246 100644 --- a/backend/tests/integration/mailing/cassettes/test_mailtrain_subscribe_user_to_list.yaml +++ b/backend/tests/integration/mailing/cassettes/test_mailtrain_subscribe_user_to_list.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: FIRST_NAME=Firstname&LAST_NAME=Lastname&EMAIL=test%40email.ch + body: FIRST_NAME=Firstname&LAST_NAME=Lastname&EMAIL=test%40email.ch&FORCE_SUBSCRIBE=yes headers: Accept: - '*/*' @@ -9,7 +9,7 @@ interactions: Connection: - keep-alive Content-Length: - - '61' + - '81' Content-Type: - application/x-www-form-urlencoded User-Agent: