You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all - many thanks for your useful solution! Saved me many hours of trying to implement the same thing from scratch (I would go with Perl though) ))))
First patch is to name the tab in browser after the subject and "from" headers, additionally it embeds the small "header-like" set of lines into html which is shown (From/Sent/Cc/Subject) making navigation in several tabs more comfortable.
While on that, (needed if "-d" is specified) second patch adds a way to interpret special file name "-" as synonym for STDIN.
diff --git a/bin/viewmailattachments.py b/bin/viewmailattachments.py
index 1730d1b..6117106 100755
--- a/bin/viewmailattachments.py
+++ b/bin/viewmailattachments.py
@@ -208,6 +208,9 @@ def view_html_message(f, tmpdir):
# but to get that you need the more complicated BytesParser method below.
# The policy argument to BytesParser is mandatory: without it,
# again, you'll get a Message and not an EmailMessage.
+ if f == "-":
+ f = None
+
if f:
if os.path.isdir(f):
# Maildir: f is a maildir like /tmp/mutttmpbox,
@@ -260,6 +263,8 @@ def view_html_message(f, tmpdir):
print()
if DEBUG:
+ print("subj:", msg.get("subject"))
+ print("from:", msg.get("from"))
print_structure(msg)
for part in msg.walk():
@@ -499,6 +504,7 @@ if __name__ == '__main__':
for f in sys.argv[1:]:
if f == '-d':
DEBUG = True
+ print ("Tempdir: ", tmpdir)
continue
view_html_message(f, tmpdir)
else:
The text was updated successfully, but these errors were encountered:
Good changes, thanks! One thing: it seems to me that the important thing your nvl() function is doing is the HTML escape, not the empty-string-if-null, so I'd prefer to call it html_escape or html_safe or something like that. Do you disagree or have an alternate suggestion? Otherwise the patch looks great.
First of all - many thanks for your useful solution! Saved me many hours of trying to implement the same thing from scratch (I would go with Perl though) ))))
First patch is to name the tab in browser after the subject and "from" headers, additionally it embeds the small "header-like" set of lines into html which is shown (From/Sent/Cc/Subject) making navigation in several tabs more comfortable.
While on that, (needed if "-d" is specified) second patch adds a way to interpret special file name "-" as synonym for STDIN.
The text was updated successfully, but these errors were encountered: