Skip to content

Instantly share code, notes, and snippets.

@mtimkovich
Last active May 3, 2019 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtimkovich/9a38508f93b956878b1b28aeeef5f992 to your computer and use it in GitHub Desktop.
Save mtimkovich/9a38508f93b956878b1b28aeeef5f992 to your computer and use it in GitHub Desktop.
For Claire. Marks all emails as read.
#!/usr/bin/env python3
from imapclient import IMAPClient, SEEN
auth = {
# Enter your user name and password between the quotes below.
'username': 'USERNAME',
'password': 'PASSWORD',
'host': 'imap.gmail.com',
}
mail = IMAPClient(auth['host'], ssl=True)
mail.login(auth['username'], auth['password'])
mail.select_folder('INBOX')
msgs = mail.search(['UNSEEN'])
mail.add_flags(msgs, [SEEN])
mail.logout()
#!/bin/bash
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
python -m pip install --user imapclient
python mail.py
@mtimkovich
Copy link
Author

  1. Download both files to the same folder
  2. Run bash run.sh from the command line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment