diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-06-01 18:02:19 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-06-01 18:02:19 +0200 |
commit | 0ab5622bd04301db5e4512c1c2ffb51e2ad7f501 (patch) | |
tree | 718ef4a1ff27cf46deb9314b3139a2c746032ee0 /do.py | |
parent | Add detokenzie for includepdf. (diff) | |
download | vimwiki-scripts-master.tar.gz vimwiki-scripts-master.tar.xz |
Diffstat (limited to 'do.py')
-rwxr-xr-x | do.py | 29 |
1 files changed, 15 insertions, 14 deletions
@@ -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(): |