Skip to content

Instantly share code, notes, and snippets.

@bollovan
Created September 9, 2011 19:14
Show Gist options
  • Save bollovan/1207072 to your computer and use it in GitHub Desktop.
Save bollovan/1207072 to your computer and use it in GitHub Desktop.
#! /usr/bin/python2
import os
import string
import urllib
#Enter your username and password below within double quotes
# eg. username="username" and password = "password"
username = "user"
password = "pass"
com = urllib.urlopen("https://" + username + ":" + password + "@mail.google.com/mail/feed/atom")
temp = com
msg = temp.read()
index = string.find(msg, "<fullcount>")
index2 = string.find(msg, "</fullcount>")
fc = int( msg[ index + 11:index2 ] )
if fc == 0:
print "no new emails"
else:
print str(fc) + " new emails"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment