summaryrefslogtreecommitdiff
path: root/alot/commands/envelope.py
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2017-08-17 12:18:42 -0700
committerGitHub <noreply@github.com>2017-08-17 12:18:42 -0700
commitadc4fbb3595b059ae98b683fe57add578c3c2b86 (patch)
treeca58aa02f2282f59bb4e7921e0b8efa071843b98 /alot/commands/envelope.py
parent1a5c3eef7983dd2d670015e7df9d2d87ae77d5ce (diff)
parent249b907bca672ccac3777a411c3c492eefecfc61 (diff)
Merge pull request #1115 from pazz/fix-account-selection
Fix issue with account selection
Diffstat (limited to 'alot/commands/envelope.py')
-rw-r--r--alot/commands/envelope.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py
index 1525bcce..b9ff51d6 100644
--- a/alot/commands/envelope.py
+++ b/alot/commands/envelope.py
@@ -118,7 +118,7 @@ class SaveCommand(Command):
# determine account to use
try:
account = settings.get_account_by_address(
- envelope.get('From'), return_default=True)
+ envelope['From'], return_default=True)
except NoMatchingAccount:
ui.notify('no accounts set.', priority='error')
return
@@ -226,17 +226,15 @@ class SendCommand(Command):
msg = self.mail
if not isinstance(msg, email.message.Message):
msg = email.message_from_string(self.mail)
+ address = msg.get('From', '')
+ logging.debug("FROM: \"%s\"" % address)
try:
- account = settings.get_account_by_address(
- msg.get('From', ''), return_default=True)
+ account = settings.get_account_by_address(address,
+ return_default=True)
except NoMatchingAccount:
ui.notify('no accounts set', priority='error')
return
-
- # make sure self.mail is a string
- logging.debug(self.mail.__class__)
- if isinstance(self.mail, email.message.Message):
- self.mail = str(self.mail)
+ logging.debug("ACCOUNT: \"%s\"" % account.address)
# define callback
def afterwards(_):
@@ -505,8 +503,7 @@ class SignCommand(Command):
return
else:
try:
- _, addr = email.utils.parseaddr(envelope.headers['From'][0])
- acc = settings.get_account_by_address(addr)
+ acc = settings.get_account_by_address(envelope['From'])
except NoMatchingAccount:
envelope.sign = False
ui.notify('Unable to find a matching account',