diff --git a/app/celery/tasks.py b/app/celery/tasks.py index 4ea787d32..c9f55126b 100644 --- a/app/celery/tasks.py +++ b/app/celery/tasks.py @@ -163,7 +163,7 @@ def invitation_template(user_name, service_name, url, expiry_date): from string import Template t = Template( '$user_name has invited you to collaborate on $service_name on GOV.UK Notify.\n\n' - 'GOV.UK Notify makes it easy to keep people updated, by helping you send text messages, emails and letters.\n\n' + 'GOV.UK Notify makes it easy to keep people updated by helping you send text messages, emails and letters.\n\n' 'Click this link to create an account on GOV.UK Notify:\n$url\n\n' 'This invitation will stop working at midnight tomorrow. This is to keep $service_name secure.') return t.substitute(user_name=user_name, service_name=service_name, url=url, expiry_date=expiry_date) @@ -191,12 +191,10 @@ def email_invited_user(encrypted_invitation): try: email_from = "{}@{}".format(current_app.config['INVITATION_EMAIL_FROM'], current_app.config['NOTIFY_EMAIL_DOMAIN']) - current_app.logger.info('email_from: {} invitation_content: {} to: {}'.format(email_from, - invitation_content, - invitation['to'])) + subject_line = invitation_subject_line(invitation['user_name'], invitation['service_name']) aws_ses_client.send_email(email_from, invitation['to'], - 'Invitation to GOV.UK Notify', + subject_line, invitation_content) except AwsSesClientException as e: current_app.logger.error(e) diff --git a/environment_test.sh b/environment_test.sh index c60a7ff21..73d03a94a 100644 --- a/environment_test.sh +++ b/environment_test.sh @@ -19,4 +19,4 @@ export TWILIO_AUTH_TOKEN="test" export TWILIO_NUMBER="test" export FIRETEXT_API_KEY="Firetext" export FIRETEXT_NUMBER="Firetext" -export NOTIFY_EMAIL_DOMAIN="test.notify.work" +export NOTIFY_EMAIL_DOMAIN="test.notify.com" diff --git a/tests/app/celery/test_tasks.py b/tests/app/celery/test_tasks.py index 491a27ff7..4b094344f 100644 --- a/tests/app/celery/test_tasks.py +++ b/tests/app/celery/test_tasks.py @@ -355,7 +355,8 @@ def test_email_invited_user_should_send_email(notify_api, mocker): email_invited_user(encryption.encrypt(invitation)) email_from = "{}@{}".format(current_app.config['INVITATION_EMAIL_FROM'], current_app.config['NOTIFY_EMAIL_DOMAIN']) + expected_subject = tasks.invitation_subject_line(invitation['user_name'], invitation['service_name']) aws_ses_client.send_email.assert_called_once_with(email_from, invitation['to'], - 'Invitation to GOV.UK Notify', + expected_subject, expected_content)