mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 01:41:05 -05:00
Let the send_email task set the from address
This commit is contained in:
@@ -180,16 +180,10 @@ def process_job(job_id):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if template.template_type == 'email':
|
if template.template_type == 'email':
|
||||||
from_email = '"{}" <{}@{}>'.format(
|
|
||||||
service.name,
|
|
||||||
service.email_from,
|
|
||||||
current_app.config['NOTIFY_EMAIL_DOMAIN']
|
|
||||||
)
|
|
||||||
|
|
||||||
send_email.apply_async((
|
send_email.apply_async((
|
||||||
str(job.service_id),
|
str(job.service_id),
|
||||||
create_uuid(),
|
create_uuid(),
|
||||||
from_email.encode('ascii', 'ignore').decode('ascii'),
|
'',
|
||||||
encrypted,
|
encrypted,
|
||||||
datetime.utcnow().strftime(DATETIME_FORMAT)),
|
datetime.utcnow().strftime(DATETIME_FORMAT)),
|
||||||
{'reply_to_addresses': service.reply_to_email_address},
|
{'reply_to_addresses': service.reply_to_email_address},
|
||||||
|
|||||||
@@ -167,13 +167,10 @@ def send_user_email_verification(user_id):
|
|||||||
'url': _create_verification_url(user_to_send_to, secret_code)
|
'url': _create_verification_url(user_to_send_to, secret_code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
email_from = '"GOV.UK Notify" <{}>'.format(
|
|
||||||
current_app.config['VERIFY_CODE_FROM_EMAIL_ADDRESS']
|
|
||||||
)
|
|
||||||
send_email.apply_async((
|
send_email.apply_async((
|
||||||
current_app.config['NOTIFY_SERVICE_ID'],
|
current_app.config['NOTIFY_SERVICE_ID'],
|
||||||
str(uuid.uuid4()),
|
str(uuid.uuid4()),
|
||||||
email_from,
|
'',
|
||||||
encryption.encrypt(message),
|
encryption.encrypt(message),
|
||||||
datetime.utcnow().strftime(DATETIME_FORMAT)
|
datetime.utcnow().strftime(DATETIME_FORMAT)
|
||||||
), queue='email-registration-verification')
|
), queue='email-registration-verification')
|
||||||
|
|||||||
@@ -248,11 +248,7 @@ def test_should_process_email_job_if_exactly_on_send_limits(notify_db,
|
|||||||
(
|
(
|
||||||
str(job.service_id),
|
str(job.service_id),
|
||||||
"uuid",
|
"uuid",
|
||||||
"\"{}\" <{}@{}>".format(
|
"",
|
||||||
service.name,
|
|
||||||
service.email_from,
|
|
||||||
"test.notify.com"
|
|
||||||
),
|
|
||||||
"something_encrypted",
|
"something_encrypted",
|
||||||
"2016-01-01T11:09:00.061258"
|
"2016-01-01T11:09:00.061258"
|
||||||
),
|
),
|
||||||
@@ -298,11 +294,7 @@ def test_should_process_email_job(sample_email_job, mocker, mock_celery_remove_j
|
|||||||
(
|
(
|
||||||
str(sample_email_job.service_id),
|
str(sample_email_job.service_id),
|
||||||
"uuid",
|
"uuid",
|
||||||
"\"{}\" <{}@{}>".format(
|
"",
|
||||||
sample_email_job.service.name,
|
|
||||||
sample_email_job.service.email_from,
|
|
||||||
"test.notify.com"
|
|
||||||
),
|
|
||||||
"something_encrypted",
|
"something_encrypted",
|
||||||
"2016-01-01T11:09:00.061258"
|
"2016-01-01T11:09:00.061258"
|
||||||
),
|
),
|
||||||
@@ -960,11 +952,7 @@ def test_process_email_job_should_use_reply_to_email_if_present(sample_email_job
|
|||||||
(
|
(
|
||||||
str(sample_email_job.service_id),
|
str(sample_email_job.service_id),
|
||||||
"uuid",
|
"uuid",
|
||||||
"\"{}\" <{}@{}>".format(
|
"",
|
||||||
sample_email_job.service.name,
|
|
||||||
sample_email_job.service.email_from,
|
|
||||||
"test.notify.com"
|
|
||||||
),
|
|
||||||
"something_encrypted",
|
"something_encrypted",
|
||||||
ANY
|
ANY
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ def test_send_user_email_verification(notify_api,
|
|||||||
app.celery.tasks.send_email.apply_async.assert_called_once_with(
|
app.celery.tasks.send_email.apply_async.assert_called_once_with(
|
||||||
(str(current_app.config['NOTIFY_SERVICE_ID']),
|
(str(current_app.config['NOTIFY_SERVICE_ID']),
|
||||||
'some_uuid',
|
'some_uuid',
|
||||||
'"GOV.UK Notify" <{}>'.format(current_app.config['VERIFY_CODE_FROM_EMAIL_ADDRESS']),
|
'',
|
||||||
"something_encrypted",
|
"something_encrypted",
|
||||||
"2016-01-01T11:09:00.061258"),
|
"2016-01-01T11:09:00.061258"),
|
||||||
queue="email-registration-verification")
|
queue="email-registration-verification")
|
||||||
|
|||||||
Reference in New Issue
Block a user