diff --git a/pagure/__init__.py b/pagure/__init__.py index b7b47f4..6a8e79a 100644 --- a/pagure/__init__.py +++ b/pagure/__init__.py @@ -189,7 +189,8 @@ if APP.config.get('PAGURE_CI_SERVICES'): if not APP.debug: APP.logger.addHandler(pagure.mail_logging.get_mail_handler( smtp_server=APP.config.get('SMTP_SERVER', '127.0.0.1'), - mail_admin=APP.config.get('MAIL_ADMIN', APP.config['EMAIL_ERROR']) + mail_admin=APP.config.get('MAIL_ADMIN', APP.config['EMAIL_ERROR']), + from_email=APP.config.get('FROM_EMAIL', 'pagure@fedoraproject.org') )) # Send classic logs into syslog diff --git a/pagure/mail_logging.py b/pagure/mail_logging.py index b7e1fdb..187cbf8 100644 --- a/pagure/mail_logging.py +++ b/pagure/mail_logging.py @@ -181,12 +181,13 @@ Callstack that lead to the logging statement """ -def get_mail_handler(smtp_server, mail_admin): +def get_mail_handler(smtp_server, mail_admin, from_email): """ Set up the handler sending emails for big exception """ + mail_handler = logging.handlers.SMTPHandler( smtp_server, - 'nobody@fedoraproject.org', + from_email, mail_admin, 'Pagure error') mail_handler.setFormatter(logging.Formatter(MSG_FORMAT))