diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2011-12-25 11:03:30 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2011-12-25 15:38:19 +0100 |
commit | 141573771b9a36718346265c9aaca3f0a80c0396 (patch) | |
tree | c64e57d86a4a1c79dd4eaa5ababeb1968c0cd25f /alot/commands/envelope.py | |
parent | c97257fc02e5b0ac84f006f2187fed753358dcb7 (diff) |
Use exceptions for error handling in SendmailAccount.send_mail
Diffstat (limited to 'alot/commands/envelope.py')
-rw-r--r-- | alot/commands/envelope.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index 21b6aa26..5e54b63f 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -8,6 +8,7 @@ from twisted.internet.defer import inlineCallbacks import threading import datetime +from alot.account import SendingMailFailed from alot import buffers from alot import commands from alot.commands import Command, registerCommand @@ -129,7 +130,12 @@ class SendCommand(Command): def thread_code(): mail = envelope.construct_mail() - os.write(write_fd, account.send_mail(mail) or 'success') + try: + account.send_mail(mail) + except SendingMailFailed as e: + os.write(write_fd, unicode(e)) + else: + os.write(write_fd, 'success') thread = threading.Thread(target=thread_code) thread.start() |