Skip to content

Instantly share code, notes, and snippets.

View amarmeena's full-sized avatar

Amar Meena amarmeena

  • Charlotte, NC
View GitHub Profile
@amarmeena
amarmeena / gmail.py
Last active November 5, 2023 00:55
Python ver3 code to download all the attachments under a gmail label and save them to specified drive location.
#Original code by Jason: https://gist.github.com/jasonrdsouza/1674794. All the credits to him. This is just my version of it.
import email, getpass, imaplib, os
detach_dir = os.getcwd()
print("Current Working Directory: ", detach_dir) # directory where to save attachments (default: current)
user = input("Enter your GMail username:")
pwd = getpass.getpass("Enter your password: ")
# connecting to the gmail imap server