Skip to content

Instantly share code, notes, and snippets.

View miguelcl's full-sized avatar

Miguel Angel Amador miguelcl

View GitHub Profile
@miguelcl
miguelcl / gmail.py
Created March 4, 2016 15:01 — 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