import os import string import time # Enter your username and password below within double quotes # eg. username="user%40domain.com" and password="password" username="username" password="password" # A file that stores the number of new messages so if a sound is used it doesn't continuously get played' apath = "~/.mailtemp" afile = open(apath, "r") num = a.read() afile.close() new = int(num) # Change the following line to it uses your domain com="wget -O - https://"+username+":"+password+"@mail.google.com/a/yourdomainhere.com/feed/atom --no-check-certificate" temp=os.popen(com) msg=temp.read() index=string.find(msg,"") index2=string.find(msg,"") fc=int(msg[index+11:index2]) if fc>new: #os.system("aplay ~/ugotmail.wav") # Uncommenting this line and changing the path will play a sounds when you get mail. f = file(apath, "w") print >> f, fc f.close() elif fc> f, fc f.close() elif fc==new: f = open(apath, "w") print >> f, fc f.close() if fc==0: print "0 New" else: print str(fc)+" New"