Created
May 15, 2023 11:45
-
-
Save stevecooperorg/856a10c3819127377ae7cf17ae3a1622 to your computer and use it in GitHub Desktop.
This file contains 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
import mailbox | |
def extract_from(mbox_file): | |
mbox = mailbox.mbox(mbox_file) | |
for message in mbox: | |
print(message['from']) | |
if __name__ == "__main__": | |
import sys | |
if len(sys.argv) != 2: | |
print(f"Usage: {sys.argv[0]} MBOX_FILE") | |
else: | |
extract_from(sys.argv[1]) | |
# use like python extract_from.py path_to_your_mbox_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment