Introduction: Python Gmail Checker

Picture of Python Gmail Checker

If you're like me then you probably don't check your email often just because you forget or don't want to waste your time if there are no new emails. Then all your emails pile up and you have to go through all of them all at once. Well today that stops. I am going to show you step by step how to run a Python script I wrote that will run every hour through windows task scheduler and open up gmail if you have any unread messages. It should take about 20 minutes so if you have time now let's get to it.

Step 1: Download Python

Picture of Download Python

Step 2: Download PyCharm

Picture of Download PyCharm

Download the community version here

www.jetbrains.com/pycharm/download/#tabs_1=windows

Step 3: In PyCharm Create a .py File

Picture of In PyCharm Create a .py File

It should be under File, New, then click python file name it whatever. I named mine hi.

Step 4: Put Code Into File and Run

Picture of Put Code Into File and Run

REPLACE USERNAME with the part in your email address before the @ and PASSWORD with your password

import imaplib

import webbrowser

obj = imaplib.IMAP4_SSL('imap.gmail.com','993')

obj.login('USERNAME','PASSWORD')

obj.select() unread = str(obj.search(None, 'UNSEEN'))

print(unread)

print(len(unread) - 13)

if (len(unread) - 13) > 0: webbrowser.open('http://gmail.com')


RUN the file by clicking run then the file name. If it fails go on to the next step. If not go to the step after the next step.

Step 5: Turn Down Security

Picture of Turn Down Security

Go to this page

www.google.com/settings/security/lesssecureapps

then set access to less secure on

Step 6: Run It Again

This time run the script and there should be no errors

Step 7: Open Windows Task Scheduler

Picture of Open Windows Task Scheduler

Search for windows task scheduler in the program search bar

Step 8: Create a Task

Follow these instructions here to create the task

Sorry I dont know how to expain this part.

http://blogs.esri.com/esri/arcgis/2013/07/30/sched...

Step 9: Done

Now every hour or whatever interval you set it at the program will run and open gmail if you have unread messages.

Here is a video of it in action.

Comments

lologainzmaster (author)2015-12-22

What is the interpreter do you use for your project? I use Python 3.5 (64 bits).INK and I think that is why it doesn't work.. Thank you.

sarju7 (author)lologainzmaster2015-12-23

my interpreter was already there when I downloaded PyCharm but also the interpreter shouldn't matter because it is just there to print out what I tell it to print which doesn't affect execution of the code. Make sure you have an unread message then try it again. Thanks and reply back if it still doesn't work

About This Instructable

2,654views

26favorites

License:

Bio: Hey!!! My name is Sarju. I am currently 16 years old and I love to program and tinker with my arduinos. I got into making ... More »
More by sarju7:Python Gmail CheckerL.E.D Tester and Container JarQuickType - A new way to type!
Add instructable to: