From cad4bbf073663db828fa7ac43b27ae00556e2797 Mon Sep 17 00:00:00 2001 From: Jefferson Stachelski Date: Fri, 30 Jan 2015 14:04:16 -0200 Subject: 249 Implemented a feature that send an email when something was wrong to send email --- service/pixelated/adapter/services/mail_service.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'service/pixelated/adapter/services/mail_service.py') diff --git a/service/pixelated/adapter/services/mail_service.py b/service/pixelated/adapter/services/mail_service.py index 26b4e162..7bf76676 100644 --- a/service/pixelated/adapter/services/mail_service.py +++ b/service/pixelated/adapter/services/mail_service.py @@ -13,8 +13,6 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see . - - class MailService: __slots__ = ['leap_session', 'account', 'mailbox_name'] @@ -44,15 +42,13 @@ class MailService: def mail_exists(self, mail_id): return not(not(self.querier.get_header_by_chash(mail_id))) - def send(self, last_draft_ident, mail): - result = self.mail_sender.sendmail(mail) + def send(self, mail): + self.mail_sender.sendmail(mail) - def success(_): - if last_draft_ident: - self.mailboxes.drafts().remove(last_draft_ident) - return self.mailboxes.sent().add(mail) - result.addCallback(success) - return result + def move_to_send(self, last_draft_ident, mail): + if last_draft_ident: + self.mailboxes.drafts().remove(last_draft_ident) + return self.mailboxes.sent().add(mail) def mark_as_read(self, mail_id): return self.mail(mail_id).mark_as_read() -- cgit v1.2.3