aboutsummaryrefslogtreecommitdiff
path: root/newspipe/notifications/emails.py
diff options
context:
space:
mode:
Diffstat (limited to 'newspipe/notifications/emails.py')
-rw-r--r--newspipe/notifications/emails.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/newspipe/notifications/emails.py b/newspipe/notifications/emails.py
index dcfcf771..9738ae95 100644
--- a/newspipe/notifications/emails.py
+++ b/newspipe/notifications/emails.py
@@ -24,8 +24,8 @@ import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
-import conf
-from web.decorators import async_maker
+from newspipe.bootstrap import application
+from newspipe.web.decorators import async_maker
logger = logging.getLogger(__name__)
@@ -33,8 +33,8 @@ logger = logging.getLogger(__name__)
@async_maker
def send_async_email(mfrom, mto, msg):
try:
- s = smtplib.SMTP(conf.NOTIFICATION_HOST)
- s.login(conf.NOTIFICATION_USERNAME, conf.NOTIFICATION_PASSWORD)
+ s = smtplib.SMTP(application.config['NOTIFICATION_HOST'])
+ s.login(application.config['NOTIFICATION_USERNAME'], application.config['NOTIFICATION_PASSWORD'])
except Exception:
logger.exception("send_async_email raised:")
else:
@@ -56,7 +56,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"] = conf.NOTIFICATION_EMAIL
+ msg["From"] = application.config['NOTIFICATION_EMAIL']
msg["To"] = to
msg["BCC"] = bcc
@@ -71,12 +71,12 @@ def send_smtp(to="", bcc="", subject="", plaintext="", html=""):
msg.attach(part2)
try:
- s = smtplib.SMTP(conf.NOTIFICATION_HOST)
- s.login(conf.NOTIFICATION_USERNAME, conf.NOTIFICATION_PASSWORD)
+ s = smtplib.SMTP(application.config['NOTIFICATION_HOST'])
+ s.login(application.config['NOTIFICATION_USERNAME'], application.config['NOTIFICATION_PASSWORD'])
except Exception:
logger.exception("send_smtp raised:")
else:
s.sendmail(
- conf.NOTIFICATION_EMAIL, msg["To"] + ", " + msg["BCC"], msg.as_string()
+ application.config['NOTIFICATION_EMAIL'], msg["To"] + ", " + msg["BCC"], msg.as_string()
)
s.quit()
bgstack15