From 2fd83f8064fa974964f1ed304f366089c673f4a0 Mon Sep 17 00:00:00 2001 From: Johannes Kulick Date: Sat, 15 Dec 2012 15:06:37 +0100 Subject: automatically fill in recipients as encryption recipients if the user doesn't supply encrypt with a list of encryption keys, the email addresses of the email recipients are used --- alot/commands/envelope.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'alot') diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index ccdbae65..cc549953 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -498,6 +498,14 @@ class EncryptCommand(Command): encrypt = not envelope.encrypt envelope.encrypt = encrypt if encrypt: + if not self.encrypt_keys: + for recipient in envelope.headers['To'][0].split(','): + match = re.search("<(.*@.*)>", recipient) + if match: + recipient = match.group(0) + self.encrypt_keys.append(recipient) + + logging.debug("encryption keys: " + str(self.encrypt_keys)) try: # cache all keys before appending to envelope, since otherwise # we get an error message but all earlier keys are added, but -- cgit v1.2.3