summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-06-01 18:02:19 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-06-01 18:02:19 +0200
commit0ab5622bd04301db5e4512c1c2ffb51e2ad7f501 (patch)
tree718ef4a1ff27cf46deb9314b3139a2c746032ee0
parentAdd detokenzie for includepdf. (diff)
downloadvimwiki-scripts-master.tar.gz
vimwiki-scripts-master.tar.xz
Add attachements-only to mail urls.HEADmaster
-rwxr-xr-xdo.py29
1 files changed, 15 insertions, 14 deletions
diff --git a/do.py b/do.py
index eb63ea7..ea9bff2 100755
--- a/do.py
+++ b/do.py
@@ -132,22 +132,23 @@ def resolve_mail(mode, source_file_name, addr, frag, comment):
with open(mailfile, 'rb') as f:
msg = email.message_from_binary_file(f, policy=default)
- if mode == 'tex':
- outstr += '\\begin{verbatim}\n'
+ if not frag == 'attachments-only':
+ if mode == 'tex':
+ outstr += '\\begin{verbatim}\n'
- # mail += msg.get_content_type() + '\n'
+ # mail += msg.get_content_type() + '\n'
- body = msg.get_body(preferencelist=('plain', 'html'))
- for field in ['Date', 'From', 'To' 'Cc', 'Subject']:
- h = msg.get(field)
- if h: outstr += f'{field}: {h}\n'
- outstr += '\n'
- if frag == 'short':
- outstr += shorten_mail(body.get_content())
- else:
- outstr += body.get_content()
- if mode == 'tex':
- outstr += '\\end{verbatim}\n'
+ body = msg.get_body(preferencelist=('plain', 'html'))
+ for field in ['Date', 'From', 'To' 'Cc', 'Subject']:
+ h = msg.get(field)
+ if h: outstr += f'{field}: {h}\n'
+ outstr += '\n'
+ if frag == 'short':
+ outstr += shorten_mail(body.get_content())
+ else:
+ outstr += body.get_content()
+ if mode == 'tex':
+ outstr += '\\end{verbatim}\n'
# TODO merge this logic with the resolve file logic below
for part in msg.iter_attachments():