diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2012-09-22 10:28:59 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2012-09-22 10:28:59 +0100 |
commit | a2b9e2262a9a69bdd1d2db8b197fcea7d20cb265 (patch) | |
tree | d4cb49babebff86d9dee8e80513367e7914c80c8 | |
parent | dd4092c00c92b542ca74323f1a7eb894fd6ce4d6 (diff) | |
parent | 126c0387d94b04c617ac279ba377cae308f230c0 (diff) |
Merge branch '0.3.3-feature-attach-header-519'
-rw-r--r-- | alot/db/envelope.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/alot/db/envelope.py b/alot/db/envelope.py index 041b26d6..f63c671b 100644 --- a/alot/db/envelope.py +++ b/alot/db/envelope.py @@ -4,6 +4,7 @@ import os import email import re +import glob import email.charset as charset charset.add_charset('utf-8', charset.QP, charset.QP, 'utf-8') from email.encoders import encode_7or8bit @@ -266,3 +267,14 @@ class Envelope(object): value += line if key and value: # save last one if present self.add(key, value) + + # interpret 'Attach' pseudo header + if 'Attach' in self: + to_attach = [] + for line in self['Attach']: + gpath = os.path.expanduser(line.strip()) + to_attach += filter(os.path.isfile, glob.glob(gpath)) + logging.debug('Attaching: %s' % to_attach) + for path in to_attach: + self.attach(path) + del(self['Attach']) |