summaryrefslogtreecommitdiff
path: root/alot/account.py
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2017-08-16 12:37:28 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2017-08-16 12:37:28 +0100
commitf67d3ac2bca0dd0dda6d5998ed1131d5b383f995 (patch)
treef89d10cd2bdc0e376fbdc5d351bb9d5946b44542 /alot/account.py
parentf33d3b3ff29e7ec555f8a791e4be3d66cf7ece42 (diff)
let SendmailAccount.send_mail cast the mail to str
instead of assuming that it already receives a string. The new behaviour is in sync with the type documented for the superclass `Account`.
Diffstat (limited to 'alot/account.py')
-rw-r--r--alot/account.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/alot/account.py b/alot/account.py
index 5965afa2..d8f114c5 100644
--- a/alot/account.py
+++ b/alot/account.py
@@ -193,7 +193,7 @@ class SendmailAccount(Account):
"""Pipe the given mail to the configured sendmail command. Display a
short message on success or a notification on error.
:param mail: the mail to send out
- :type mail: str
+ :type mail: :class:`email.message.Message` or string
:returns: the deferred that calls the sendmail command
:rtype: `twisted.internet.defer.Deferred`
"""
@@ -214,6 +214,9 @@ class SendmailAccount(Account):
logging.error(failure.value.stderr)
raise SendingMailFailed(errmsg)
+ # make sure self.mail is a string
+ mail = str(mail)
+
d = call_cmd_async(cmdlist, stdin=mail)
d.addCallback(cb)
d.addErrback(errb)