diff --git a/common/djangoapps/student/tasks.py b/common/djangoapps/student/tasks.py index 1e96fe523e..73b02a6261 100644 --- a/common/djangoapps/student/tasks.py +++ b/common/djangoapps/student/tasks.py @@ -10,16 +10,19 @@ from celery.task import task # pylint: disable=no-name-in-module, import-error from django.conf import settings from edx_ace import ace from edx_ace.errors import RecoverableChannelDeliveryError +from edx_ace.message import Message from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers log = logging.getLogger('edx.celery.task') @task(bind=True) -def send_activation_email(self, msg, from_address=None): +def send_activation_email(self, msg_string, from_address=None): """ Sending an activation email to the user. """ + msg = Message.from_string(msg_string) + max_retries = settings.RETRY_ACTIVATION_EMAIL_MAX_ATTEMPTS retries = self.request.retries diff --git a/common/djangoapps/student/tests/test_email.py b/common/djangoapps/student/tests/test_email.py index 4901c390b7..4fb45df0ec 100644 --- a/common/djangoapps/student/tests/test_email.py +++ b/common/djangoapps/student/tests/test_email.py @@ -31,7 +31,6 @@ from student.views import ( confirm_email_change, do_email_change_request, generate_activation_email_context, - send_reactivation_email_for_user, validate_new_email ) from third_party_auth.views import inactive_user_view diff --git a/common/djangoapps/student/tests/test_tasks.py b/common/djangoapps/student/tests/test_tasks.py index b14e8dc3e6..bbebedc629 100644 --- a/common/djangoapps/student/tests/test_tasks.py +++ b/common/djangoapps/student/tests/test_tasks.py @@ -50,7 +50,7 @@ class SendActivationEmailTestCase(TestCase): from_address = 'task_testing@example.com' email_max_attempts = settings.RETRY_ACTIVATION_EMAIL_MAX_ATTEMPTS - send_activation_email.delay(self.msg, from_address=from_address) + send_activation_email.delay(str(self.msg), from_address=from_address) # Asserts sending email retry logging. for attempt in range(email_max_attempts): @@ -79,7 +79,7 @@ class SendActivationEmailTestCase(TestCase): """ from_address = 'task_testing@example.com' - send_activation_email.delay(self.msg, from_address=from_address) + send_activation_email.delay(str(self.msg), from_address=from_address) # Asserts that the error was logged mock_log.exception.assert_called_with( diff --git a/common/djangoapps/student/views/management.py b/common/djangoapps/student/views/management.py index 9c3975cd37..523fa444b0 100644 --- a/common/djangoapps/student/views/management.py +++ b/common/djangoapps/student/views/management.py @@ -233,7 +233,7 @@ def compose_and_send_activation_email(user, profile, user_registration=None): root_url = configuration_helpers.get_value('LMS_ROOT_URL', settings.LMS_ROOT_URL) msg = compose_activation_email(root_url, user, user_registration, route_enabled, profile.name) - send_activation_email.delay(msg) + send_activation_email.delay(str(msg)) @login_required