Loading src/common/mail.py +10 −4 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ from common.env import check_environment as ce from common.logz import create_logger def send_email(subject, text, files=None): def send_email(subject, text, files=None, recipients=None): """ Send email to the EMAIL_RECIPIENTS env variable with the given subject and message body from the EMAIL_SENDER address. Email debug level is controlled with the EMAIL_DEBUG_LEVEL environmental variable and Loading @@ -31,13 +31,19 @@ def send_email(subject, text, files=None): if from_address is None: logger.critical('Unable to send email as no EMAIL_SENDER set') return None try: if recipients is None: to_address = ce('EMAIL_RECIPIENTS') else: to_address = recipients if ',' in to_address: to_address = ', '.join(to_address.split(',')) except AttributeError: logger.critical('No EMAIL_RECIPIENTS set.') return None msg = MIMEMultipart() msg['From'] = from_address msg['To'] = to_address Loading Loading
src/common/mail.py +10 −4 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ from common.env import check_environment as ce from common.logz import create_logger def send_email(subject, text, files=None): def send_email(subject, text, files=None, recipients=None): """ Send email to the EMAIL_RECIPIENTS env variable with the given subject and message body from the EMAIL_SENDER address. Email debug level is controlled with the EMAIL_DEBUG_LEVEL environmental variable and Loading @@ -31,13 +31,19 @@ def send_email(subject, text, files=None): if from_address is None: logger.critical('Unable to send email as no EMAIL_SENDER set') return None try: if recipients is None: to_address = ce('EMAIL_RECIPIENTS') else: to_address = recipients if ',' in to_address: to_address = ', '.join(to_address.split(',')) except AttributeError: logger.critical('No EMAIL_RECIPIENTS set.') return None msg = MIMEMultipart() msg['From'] = from_address msg['To'] = to_address Loading