Created
October 23, 2023 10:17
-
-
Save julian-klode/91d2ddc81c150a5efdfeba9ba7fff5d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import email | |
import sys | |
import base64 | |
preserve=["from", "subject", "date"] | |
msg = email.message_from_file(sys.stdin) | |
for key in msg: | |
if not key.lower() in preserve: | |
del msg[key] | |
msg.set_payload(base64.b64decode(msg.get_payload())) | |
sys.stdout.write(msg.as_string()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment