diff options
Diffstat (limited to 'newspipe')
-rw-r--r-- | newspipe/notifications/emails.py | 15 | ||||
-rw-r--r-- | newspipe/notifications/notifications.py | 2 |
2 files changed, 9 insertions, 8 deletions
diff --git a/newspipe/notifications/emails.py b/newspipe/notifications/emails.py index 31eceaeb..8c2f24a1 100644 --- a/newspipe/notifications/emails.py +++ b/newspipe/notifications/emails.py @@ -59,7 +59,7 @@ def send_smtp(to="", bcc="", subject="", plaintext="", html=""): # Create message container - the correct MIME type is multipart/alternative. msg = MIMEMultipart("alternative") msg["Subject"] = subject - msg["From"] = application.config["NOTIFICATION_EMAIL"] + msg["From"] = application.config["MAIL_DEFAULT_SENDER"] msg["To"] = to msg["BCC"] = bcc @@ -74,16 +74,17 @@ def send_smtp(to="", bcc="", subject="", plaintext="", html=""): msg.attach(part2) try: - s = smtplib.SMTP(application.config["NOTIFICATION_HOST"]) - s.login( - application.config["NOTIFICATION_USERNAME"], - application.config["NOTIFICATION_PASSWORD"], - ) + s = smtplib.SMTP(application.config["MAIL_SERVER"]) + if application.config["MAIL_USERNAME"] is not None: + s.login( + application.config["MAIL_USERNAME"], + application.config["MAIL_PASSWORD"], + ) except Exception: logger.exception("send_smtp raised:") else: s.sendmail( - application.config["NOTIFICATION_EMAIL"], + application.config["MAIL_DEFAULT_SENDER"], msg["To"] + ", " + msg["BCC"], msg.as_string(), ) diff --git a/newspipe/notifications/notifications.py b/newspipe/notifications/notifications.py index 2e7ec399..df826452 100644 --- a/newspipe/notifications/notifications.py +++ b/newspipe/notifications/notifications.py @@ -47,7 +47,7 @@ def new_account_notification(user, email): emails.send( to=email, - bcc=application.config["NOTIFICATION_EMAIL"], + bcc=application.config["MAIL_DEFAULT_SENDER"], subject="[Newspipe] Account creation", plaintext=plaintext, ) |