aboutsummaryrefslogtreecommitdiff
path: root/newspipe
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2020-03-14 14:26:50 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2020-03-14 14:26:50 +0100
commit667d59bbeea4ac768949ea1cac66e65cbf8ca350 (patch)
treec3ccc784f8d098fee7761297835f4888da7c536a /newspipe
parentPreparing new 9.1.0 release. (diff)
downloadnewspipe-667d59bbeea4ac768949ea1cac66e65cbf8ca350.tar.gz
newspipe-667d59bbeea4ac768949ea1cac66e65cbf8ca350.tar.bz2
newspipe-667d59bbeea4ac768949ea1cac66e65cbf8ca350.zip
Fixed email notifications.
Diffstat (limited to 'newspipe')
-rw-r--r--newspipe/notifications/emails.py15
-rw-r--r--newspipe/notifications/notifications.py2
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,
)
bgstack15