1.1 --- a/tools/showmail.py Mon Feb 08 22:03:57 2016 +0100
1.2 +++ b/tools/showmail.py Mon Feb 08 22:43:55 2016 +0100
1.3 @@ -1,8 +1,18 @@
1.4 #!/usr/bin/env python
1.5
1.6 -from email import message_from_file
1.7 +from email import message_from_string
1.8 import sys
1.9
1.10 +def until_from(f):
1.11 + l = []
1.12 + s = f.readline()
1.13 + while s:
1.14 + l.append(s)
1.15 + s = f.readline()
1.16 + if s.startswith("From "):
1.17 + break
1.18 + return "".join(l)
1.19 +
1.20 def decode(part):
1.21 for key, value in part.items():
1.22 if key != "Content-Transfer-Encoding":
1.23 @@ -16,7 +26,7 @@
1.24 for part in part.get_payload():
1.25 decode(part)
1.26
1.27 -message = message_from_file(sys.stdin)
1.28 +message = message_from_string(until_from(sys.stdin))
1.29 decode(message)
1.30
1.31 # vim: tabstop=4 expandtab shiftwidth=4