Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch to add uid to message class to make it easier to track #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions gmaillib.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
#6. body -- content of the email

class message:
def __init__(self, fetched_email):
def __init__(self, fetched_email, email_id):
accepted_types = ['text/plain']
parsed = email.message_from_string(fetched_email)
self.parsed_email = email.message_from_string(fetched_email)
self.uid = email_id
self.parsed_email = email.message_from_string(fetched_email)
self.receiver_addr = parsed['to']
self.sender_addr = parsed['from']
self.date = parsed['date']
Expand Down Expand Up @@ -160,7 +161,7 @@ def get_email(self, email_id):
self.receiveserver.select('Inbox')
#This nasty syntax fetches the email as a string
fetched_email = self.receiveserver.fetch(email_id, "(RFC822)")[1][0][1]
parsed_email = message(fetched_email)
parsed_email = message(fetched_email, email_id)
return parsed_email

def inbox(self, start=0, amount=10):
Expand Down