summaryrefslogtreecommitdiff
path: root/alot/commands/envelope.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-06-01 14:33:03 -0700
committerDylan Baker <dylan@pnwbakers.com>2018-03-01 10:34:56 -0800
commitf64159a19d0c8e17157803663eb79496b74ae422 (patch)
tree155e94e8e554fe0900cfd6b8b30ead5be366db7d /alot/commands/envelope.py
parent9a5f18920e7c304bfaee842ea4600b972e600ee6 (diff)
py3k: convert email.Utils to email.utils
Diffstat (limited to 'alot/commands/envelope.py')
-rw-r--r--alot/commands/envelope.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py
index d008d227..5e62cf43 100644
--- a/alot/commands/envelope.py
+++ b/alot/commands/envelope.py
@@ -225,6 +225,7 @@ class SendCommand(Command):
msg = self.mail
if not isinstance(msg, email.message.Message):
msg = email.message_from_string(self.mail)
+<<<<<<< HEAD
address = msg.get('From', '')
logging.debug("FROM: \"%s\"" % address)
try:
@@ -234,6 +235,21 @@ class SendCommand(Command):
ui.notify('no accounts set', priority='error')
return
logging.debug("ACCOUNT: \"%s\"" % account.address)
+=======
+ _, saddr = email.utils.parseaddr(msg.get('From', ''))
+ account = settings.get_account_by_address(saddr)
+ if account is None:
+ if not settings.get_accounts():
+ ui.notify('no accounts set', priority='error')
+ return
+ else:
+ account = settings.get_accounts()[0]
+
+ # make sure self.mail is a string
+ logging.debug(self.mail.__class__)
+ if isinstance(self.mail, email.message.Message):
+ self.mail = str(self.mail)
+>>>>>>> py3k: convert email.Utils to email.utils
# define callback
def afterwards(_):