Build the from address in the task instead of the rest call.

This commit is contained in:
Rebecca Law
2016-06-13 14:09:03 +01:00
parent ea80596e73
commit c9f1eb65a7
3 changed files with 5 additions and 2 deletions

View File

@@ -343,6 +343,9 @@ def send_email(service_id, notification_id, from_address, encrypted_notification
(provider.get_name(), str(reference), notification['to']), queue='research-mode'
)
else:
# First step setting the from_address here rather than the method creating the task
from_address = '"{}" <{}@{}>'.format(service.name, service.email_from, current_app.config[
'NOTIFY_EMAIL_DOMAIN']) if from_address == "" else from_address
reference = provider.send_email(
from_address,
notification['to'],

View File

@@ -387,7 +387,7 @@ def send_notification(notification_type):
send_email.apply_async((
service_id,
notification_id,
'"{}" <{}@{}>'.format(service.name, service.email_from, current_app.config['NOTIFY_EMAIL_DOMAIN']),
'',
encryption.encrypt(notification),
datetime.utcnow().strftime(DATETIME_FORMAT)
), queue='email')