Skip to content

Instantly share code, notes, and snippets.

View rlouf's full-sized avatar

Rémi Louf rlouf

View GitHub Profile
@rlouf
rlouf / gmail.py
Created January 6, 2018 13:57 — forked from jasonrdsouza/gmail.py
Python script to access a gmail account and download particular emails
import email, getpass, imaplib, os
detach_dir = '.' # directory where to save attachments (default: current)
user = raw_input("Enter your GMail username:")
pwd = getpass.getpass("Enter your password: ")
# connecting to the gmail imap server
m = imaplib.IMAP4_SSL("imap.gmail.com")
m.login(user,pwd)
m.select("cs2043") # here you a can choose a mail box like INBOX instead