diff options
author | Gabriel Albo <gabriel@albo.com.br> | 2015-11-04 12:00:07 -0200 |
---|---|---|
committer | Gabriel Albo <gabriel@albo.com.br> | 2015-11-04 12:00:07 -0200 |
commit | 1726b1ec3797b20b97adb184210c9e601a7c82b9 (patch) | |
tree | 04b0e8d8b2c2f969035323171c0123a07f023f2a /service/pixelated | |
parent | fdb8800091978ab0c4075842982c19f96903f57c (diff) | |
parent | 4bc459e55331f8a07a676598bac264d54fb818d7 (diff) |
Merge branch 'master' of github.com:pixelated-project/pixelated-user-agent
Diffstat (limited to 'service/pixelated')
-rw-r--r-- | service/pixelated/adapter/services/mail_sender.py | 10 | ||||
-rw-r--r-- | service/pixelated/config/services.py | 8 |
2 files changed, 13 insertions, 5 deletions
diff --git a/service/pixelated/adapter/services/mail_sender.py b/service/pixelated/adapter/services/mail_sender.py index ca1e99d7..faf3d228 100644 --- a/service/pixelated/adapter/services/mail_sender.py +++ b/service/pixelated/adapter/services/mail_sender.py @@ -21,6 +21,7 @@ from twisted.internet.defer import Deferred, fail from twisted.mail.smtp import SMTPSenderFactory from twisted.internet import reactor, defer from pixelated.support.functional import flatten +from twisted.mail.smtp import User class SMTPDownException(Exception): @@ -28,6 +29,9 @@ class SMTPDownException(Exception): Exception.__init__(self, "Couldn't send mail now, try again later.") +NOT_NEEDED = None + + class MailSender(object): def __init__(self, smtp_config, keymanager): @@ -40,7 +44,8 @@ class MailSender(object): deferreds = [] for recipient in recipients: - deferreds.append(outgoing_mail.send_message(mail.to_smtp_format(), recipient)) + smtp_recipient = self._create_twisted_smtp_recipient(recipient) + deferreds.append(outgoing_mail.send_message(mail.to_smtp_format(), smtp_recipient)) return defer.gatherResults(deferreds) @@ -52,6 +57,9 @@ class MailSender(object): str(self._smtp_config.remote_smtp_host), int(self._smtp_config.remote_smtp_port)) + def _create_twisted_smtp_recipient(self, recipient): + return User(str(recipient), NOT_NEEDED, NOT_NEEDED, NOT_NEEDED) + class LocalSmtpMailSender(object): diff --git a/service/pixelated/config/services.py b/service/pixelated/config/services.py index cd475228..e4bf394c 100644 --- a/service/pixelated/config/services.py +++ b/service/pixelated/config/services.py @@ -55,11 +55,11 @@ class Services(object): self.search_engine = search_engine def setup_mail_service(self, leap_session, search_engine): - pixelated_mail_sender = LocalSmtpMailSender( - leap_session.account_email(), - leap_session.smtp) + # pixelated_mail_sender = LocalSmtpMailSender( + # leap_session.account_email(), + # leap_session.smtp) - MailSender(leap_session.smtp._smtp_config, leap_session.nicknym.keymanager) + pixelated_mail_sender = MailSender(leap_session.smtp._smtp_config, leap_session.nicknym.keymanager) return MailService( pixelated_mail_sender, |