Merge pull request #2635 from jakedt/returntosender

Use MAIL_DEFAULT_SENDER as the sender in email notifications
This commit is contained in:
Jake Moshenko 2017-05-10 14:34:37 -04:00 committed by GitHub
commit b96b871c3a

View file

@ -159,17 +159,16 @@ class EmailMethod(NotificationMethod):
if not email: if not email:
return return
msg = Message(event_handler.get_summary(notification_data['event_data'], notification_data), with app.app_context():
sender='support@quay.io', msg = Message(event_handler.get_summary(notification_data['event_data'], notification_data),
recipients=[email]) recipients=[email])
msg.html = event_handler.get_message(notification_data['event_data'], notification_data) msg.html = event_handler.get_message(notification_data['event_data'], notification_data)
try: try:
with app.app_context(): mail.send(msg)
mail.send(msg) except Exception as ex:
except Exception as ex: logger.exception('Email was unable to be sent: %s' % ex.message)
logger.exception('Email was unable to be sent: %s' % ex.message) raise NotificationMethodPerformException(ex.message)
raise NotificationMethodPerformException(ex.message)
class WebhookMethod(NotificationMethod): class WebhookMethod(NotificationMethod):