From 4189422340a06f32d0a5a8fb078718c6ace57f3f Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Wed, 10 May 2017 14:24:27 -0400 Subject: [PATCH] Use MAIL_DEFAULT_SENDER as the sender in email notifications --- endpoints/notificationmethod.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/endpoints/notificationmethod.py b/endpoints/notificationmethod.py index b315be9b6..e432c680c 100644 --- a/endpoints/notificationmethod.py +++ b/endpoints/notificationmethod.py @@ -159,17 +159,16 @@ class EmailMethod(NotificationMethod): if not email: return - msg = Message(event_handler.get_summary(notification_data['event_data'], notification_data), - sender='support@quay.io', - recipients=[email]) - msg.html = event_handler.get_message(notification_data['event_data'], notification_data) + with app.app_context(): + msg = Message(event_handler.get_summary(notification_data['event_data'], notification_data), + recipients=[email]) + msg.html = event_handler.get_message(notification_data['event_data'], notification_data) - try: - with app.app_context(): - mail.send(msg) - except Exception as ex: - logger.exception('Email was unable to be sent: %s' % ex.message) - raise NotificationMethodPerformException(ex.message) + try: + mail.send(msg) + except Exception as ex: + logger.exception('Email was unable to be sent: %s' % ex.message) + raise NotificationMethodPerformException(ex.message) class WebhookMethod(NotificationMethod):