diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-02-05 11:21:48 +0100 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-02-05 15:26:58 +0100 |
commit | 9893a5409560e1cc7123ec42d12b49e6edd6283c (patch) | |
tree | 3933147ea994a4ea71536d0c6be084827418f56d /service/pixelated/adapter/services/mail_service.py | |
parent | a471b8e494b46fd85022b2105eee50fec4f84996 (diff) |
(Re-)added error handling for twisted smtp sender.
- Issue #249
- Fixed all tests with that rely on sendmail deferred.
Diffstat (limited to 'service/pixelated/adapter/services/mail_service.py')
-rw-r--r-- | service/pixelated/adapter/services/mail_service.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/service/pixelated/adapter/services/mail_service.py b/service/pixelated/adapter/services/mail_service.py index 6e309ee0..1e0a0414 100644 --- a/service/pixelated/adapter/services/mail_service.py +++ b/service/pixelated/adapter/services/mail_service.py @@ -55,10 +55,12 @@ class MailService: mail = InputMail.from_dict(content_dict) draft_id = content_dict.get('ident') - self.mail_sender.sendmail(mail) - sent_mail = self.move_to_sent(draft_id, mail) + def move_to_sent(_): + return self.move_to_sent(draft_id, mail) - return sent_mail + deferred = self.mail_sender.sendmail(mail) + deferred.addCallback(move_to_sent) + return deferred def move_to_sent(self, last_draft_ident, mail): if last_draft_ident: |