Browse Source

Use default title as email subject

pull/1298/head
Ruud 12 years ago
parent
commit
fe52ac7203
  1. 5
      couchpotato/core/notifications/email/__init__.py
  2. 12
      couchpotato/core/notifications/email/main.py

5
couchpotato/core/notifications/email/__init__.py

@ -24,11 +24,6 @@ config = [{
'label': 'Send e-mail to', 'label': 'Send e-mail to',
}, },
{ {
'name': 'subject',
'label': 'Subject',
'default': 'Couch Potato report',
},
{
'name': 'smtp_server', 'name': 'smtp_server',
'label': 'SMTP server', 'label': 'SMTP server',
}, },

12
couchpotato/core/notifications/email/main.py

@ -2,8 +2,8 @@ from couchpotato.core.helpers.encoding import toUnicode
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
from couchpotato.core.notifications.base import Notification from couchpotato.core.notifications.base import Notification
from email.mime.text import MIMEText from email.mime.text import MIMEText
import traceback
import smtplib import smtplib
import traceback
log = CPLog(__name__) log = CPLog(__name__)
@ -13,7 +13,7 @@ class Email(Notification):
def notify(self, message = '', data = {}, listener = None): def notify(self, message = '', data = {}, listener = None):
if self.isDisabled(): return if self.isDisabled(): return
# Extract all the settings from the database # Extract all the settings from settings
from_address = self.conf('from') from_address = self.conf('from')
to = self.conf('to') to = self.conf('to')
smtp_server = self.conf('smtp_server') smtp_server = self.conf('smtp_server')
@ -23,17 +23,13 @@ class Email(Notification):
# Make the basic message # Make the basic message
message = MIMEText(toUnicode(message)) message = MIMEText(toUnicode(message))
message['Subject'] = self.conf('subject') message['Subject'] = self.default_title
message['From'] = from_address message['From'] = from_address
message['To'] = to message['To'] = to
try: try:
# Open the SMTP connection, via SSL if requested # Open the SMTP connection, via SSL if requested
if ssl == 1: mailserver = smtplib.SMTP_SSL(smtp_server) if ssl == 1 else smtplib.SMTP(smtp_server)
mailserver = smtplib.SMTP_SSL(smtp_server)
else:
mailserver = smtplib.SMTP(smtp_server)
# Check too see if an login attempt should be attempted # Check too see if an login attempt should be attempted
if len(smtp_user) > 0: if len(smtp_user) > 0:

Loading…
Cancel
Save