Arshpreet_1 0 Newbie Poster

I am making a Python script which will search for Thread-ID and according to thread-ID it will find corresponding UIDs. After getting the UID I will be able to get required data for analysis. My ultimate goal is to make a graph, something like the following:

https://dl.dropboxusercontent.com/u/32435266/Graph3.png

Is this the correct approach, getting data from conversations/threads so I can calculate the time in which "user get Email and respond back"?

from imaplib import IMAP4_SSL
import email
mail = IMAP4_SSL('imap.gmail.com')

mail.login('gmail_id@gmail.com','gmail_password')

mail.select('INBOX')

_,uid = mail.uid('search', None, 'ALL')

x = uid[0].split() # We are getting list of UIDs
i=0
while(i<len(x)):

    print x[i]
    result, data = mail.uid('fetch', x[i], '(X-GM-THRID)')

    m = data[0].split()
    print m[2]
    result1, data1 = mail.uid('search','X-GM-THRID',m[2])
    print data1[0].split() # getting list of UIDs for corresponding Thread-ID
    i+=1

So after getting list of UIDs for perticular thread ID how I should fetch data so I could get the results for the graph shown in the link?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.