Skip to content

rajivm1991/Python-Gmail

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Python module for GMail

Simple Python module to interact with Google's mail service GMail. The module uses Python's included imaplib and smtplib for recieving and sending emails.

The goal of this module is to provide a simple direct interface to GMail.

Usage

To initialize an account you do the following

import gmaillib

account = gmaillib.account('username', 'password')

To get messages from the inbox just call the use the inbox method

account.inbox()

To get a range of messages just give the place to start from and how many to fetch

account.inbox(start=10, amount=100)

This will fetch the 10th to the 110th message

To get the entire contents of the inbox(note if you have a large inbox this could take a while)

account.get_all_messages()

You can also just get the number of messages in the inbox which is less time consuming.

account.get_inbox_count()

To only get the unread messages of the inbox

account.unread();

To send an email

account.send(target, subject, message)

Note that the subject and message are optional.

Credits

A large part of this library is implementing this excellent blogpost: http://yuji.wordpress.com/2011/06/22/python-imaplib-imap-example-with-gmail/

About

A simple library to interact with Gmail through python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%