Personal tools
Document Actions

Gmailchecker

Up to Scripts

Gmailchecker

Posted by Olivier Lauzanne at July 16. 2007
This small script (32 lines) will check your gmail account every 15 seconds and say : "hey ! you've got a new email." when you get one.
Also the eyes of tux are opened when there are unread emails and closed when there aren't any.

Usage:
python gmailchecker.py login password
Attachments

Re: Gmailchecker

Posted by enguerran at July 16. 2007

Thanks for this script. I was searching for a way to check my Gmail account.


I didn't know there was a python library for gmail.


I'll test it right after work.


Thanks


Re: Gmailchecker

Posted by Olivier Lauzanne at July 16. 2007

Oh yeah I forgot to say you need to have libgmail installed http://libgmail.sourceforge.net/


Re: Gmailchecker

Posted by enguerran at July 16. 2007

Works just great ^^


If you want you change change your "while" as :


    while True:
    folder = ga.getUnreadMessages()
    for thread in folder:
          for msg in thread:
                tts.cmd.speak("Hey ! You've got a new mail from " + msg.author)
                tts.cmd.speak("The subject is " + msg.subject)
    time.sleep(15)




so that it reads the author and the subject of the email.


Re: Gmailchecker

Posted by Bastian Kennel at August 07. 2007

Previously enguerran wrote:





Works just great ^^




If you want you change change your "while" as :




    while True:
    folder = ga.getUnreadMessages()
    for thread in folder:
          for msg in thread:
                tts.cmd.speak("Hey ! You've got a new mail from " + msg.author)
                tts.cmd.speak("The subject is " + msg.subject)
    time.sleep(15)







so that it reads the author and the subject of the email.





Thank you for your input. It works good. I personally prefer to put the two speak commands in one so he doesn't close his mouth between speaking.
This code however marks the messages in gmail as read, which is not good for me. Is there a simple way to prevent this, like
msg.setRead(false)
after speaking or so? Sorry, but I am not familiar with the python-mail API.
Slightly OT: I would like to learn a bit more about python and its API's. Can any1 suggest a good (online) read? I am not new to programming, so I don't need to learn what an if does ;)

cheers Bastian
Powered by Ploneboard
You are here: Home Forum Scripts Gmailchecker

Powered by Plone CMS, the Open Source Content Management System