Friday, September 18, 2009

Using Gmail's Email Autocompletion to your advantage

Hello All,

This post is specially directed towards the Hostel Sysads of IIT Bombay Hostels.

What problem are we trying to solve ?
When mails and couriers arrive at the Hall Manager's Office in our hostels, we want to set up an easy system which will allow the Hallie's assistant to notify those who have got mails by sending emails to them.

How?
We will create a file which has mappings from Room No of student to his EmailId in a .csv format which will be accepted by Gmail. Then Gmail's autocompletion feature will display the email id when you write the room no.

Requirements:
1) An input file which contains mapping of room no. and email id of person living in that room
2) A python script which converts this input file into .csv [CSV = comma separated values] which Gmail accepts.

Download this zip file. It has three files.
a) A sample input file named "HostelAddressBook.txt". In that file, you will see two columns. First column is a room no. and second column is an email id of person living in that room.
b) HAB4Gmail.py file.
c) An output file "mappings.csv" which was generated after running the python script on the input file.


Steps:
1) Download the above file and extract it.
2) Run the script by typing "python HABinGmail.py" on the terminal in linux.
3) Output file: "mappings.csv" is generated.
4) Import this file into Hostel Office Gmail account by following the instructions given here.
5) Testing: Once the import is completed, start to compose email. In the "To" field, write the room no(e.g. A704 ) which is present in the input file.



The python script used in above code is hardly of ten lines. You can easily understand the code and modify it to suit your needs. Like if you need mappings from a person name to email id rather than room no.

Please do post comments and modifications.

1 comment:

Advait Mohan Raut said...

Dear Author,
Nice initiative. I tried the program. Although the python script created the output file correctly. It ended with exception.