From 5b29217cdea1bfd487bfe8ee064559a88540ca58 Mon Sep 17 00:00:00 2001 From: Folker Bernitt Date: Wed, 4 Nov 2015 14:22:59 +0100 Subject: Change str email to twisted.mail.smtp.User - Issue #499 - leap.mail relies on this --- service/pixelated/adapter/services/mail_sender.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'service/pixelated/adapter') 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): -- cgit v1.2.3