rr- 2578a297bf server/general: improve pylint score
+ incorporate some in-house rules - no more useless doc strings...
2016-04-03 19:17:54 +02:00

20 lines
564 B
Python

import smtplib
import email.mime.text
class Mailer(object):
def __init__(self, config):
self._config = config
def send(self, sender, recipient, subject, body):
msg = email.mime.text.MIMEText(body)
msg['Subject'] = subject
msg['From'] = sender
msg['To'] = recipient
smtp = smtplib.SMTP(
self._config['smtp']['host'],
int(self._config['smtp']['port']))
smtp.login(self._config['smtp']['user'], self._config['smtp']['pass'])
smtp.send_message(msg)
smtp.quit()