Loading src/common/mail.py +3 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ def send_email(subject, text, files=None, recipients=None): relay_address = ce('RELAY_ADDRESS') relay_port = ce('RELAY_PORT') relay_password = ce('RELAY_PASSWORD') relay_user = ce('RELAY_USER') smtp_port = ce('SMTP_PORT', 25) if from_address is None: logger.critical('Unable to send email as no EMAIL_SENDER set') Loading Loading @@ -84,13 +85,13 @@ def send_email(subject, text, files=None, recipients=None): server.quit() logger.info(f'Email successfully sent to {to_address}.') elif all(var is not None for var in [relay_address, relay_port, relay_password]): relay_password, relay_user]): # allow ssl connection context = ssl.create_default_context() with smtplib.SMTP(relay_address, relay_port) as conn: conn.ehlo() conn.starttls(context=context) conn.login(from_address, relay_password) conn.login(relay_user, relay_password) conn.send_message(msg) conn.quit() logger.info(f'Email successfully sent to {to_address}.') Loading Loading
src/common/mail.py +3 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ def send_email(subject, text, files=None, recipients=None): relay_address = ce('RELAY_ADDRESS') relay_port = ce('RELAY_PORT') relay_password = ce('RELAY_PASSWORD') relay_user = ce('RELAY_USER') smtp_port = ce('SMTP_PORT', 25) if from_address is None: logger.critical('Unable to send email as no EMAIL_SENDER set') Loading Loading @@ -84,13 +85,13 @@ def send_email(subject, text, files=None, recipients=None): server.quit() logger.info(f'Email successfully sent to {to_address}.') elif all(var is not None for var in [relay_address, relay_port, relay_password]): relay_password, relay_user]): # allow ssl connection context = ssl.create_default_context() with smtplib.SMTP(relay_address, relay_port) as conn: conn.ehlo() conn.starttls(context=context) conn.login(from_address, relay_password) conn.login(relay_user, relay_password) conn.send_message(msg) conn.quit() logger.info(f'Email successfully sent to {to_address}.') Loading