From f64159a19d0c8e17157803663eb79496b74ae422 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 1 Jun 2017 14:33:03 -0700 Subject: py3k: convert email.Utils to email.utils --- alot/commands/envelope.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'alot/commands/envelope.py') 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(_): -- cgit v1.2.3