diff options
author | Dylan Baker <baker.dylan.c@gmail.com> | 2017-08-17 12:18:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-17 12:18:42 -0700 |
commit | adc4fbb3595b059ae98b683fe57add578c3c2b86 (patch) | |
tree | ca58aa02f2282f59bb4e7921e0b8efa071843b98 /alot/commands/envelope.py | |
parent | 1a5c3eef7983dd2d670015e7df9d2d87ae77d5ce (diff) | |
parent | 249b907bca672ccac3777a411c3c492eefecfc61 (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.py | 17 |
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', |