diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-11-04 10:11:19 +0100 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-11-04 12:02:53 +0100 |
commit | d79aa00e3c24c5bf5e5ed5ba5a9b976f93034362 (patch) | |
tree | 87a32a2e85d04b3bebc2ceb4aa56b447488940b6 /service/pixelated/adapter/services | |
parent | ffa355c46eda5d05f25890420218845ac3e53f71 (diff) |
Instantiate new MailSender in Services
- Issue #499
- Some smaller refactorings
- Extract smtp cert download to own class
Diffstat (limited to 'service/pixelated/adapter/services')
-rw-r--r-- | service/pixelated/adapter/services/mail_sender.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/service/pixelated/adapter/services/mail_sender.py b/service/pixelated/adapter/services/mail_sender.py index a3315b53..ca1e99d7 100644 --- a/service/pixelated/adapter/services/mail_sender.py +++ b/service/pixelated/adapter/services/mail_sender.py @@ -30,12 +30,9 @@ class SMTPDownException(Exception): class MailSender(object): - def __init__(self, account_email_address, keymanager, cert_path, remote_smtp_host, remote_smtp_port): - self._from = account_email_address + def __init__(self, smtp_config, keymanager): + self._smtp_config = smtp_config self._keymanager = keymanager - self._cert_path = cert_path - self._remote_smtp_host = remote_smtp_host - self._remote_smtp_port = remote_smtp_port def sendmail(self, mail): recipients = flatten([mail.to, mail.cc, mail.bcc]) @@ -48,7 +45,12 @@ class MailSender(object): return defer.gatherResults(deferreds) def _create_outgoing_mail(self): - return OutgoingMail(str(self._from), self._keymanager, unicode(self._cert_path), unicode(self._cert_path), str(self._remote_smtp_host), int(self._remote_smtp_port)) + return OutgoingMail(str(self._smtp_config.account_email), + self._keymanager, + self._smtp_config.cert_path, + self._smtp_config.cert_path, + str(self._smtp_config.remote_smtp_host), + int(self._smtp_config.remote_smtp_port)) class LocalSmtpMailSender(object): |