From 5aa1017873cac9a01d667ba8f177937227b46b27 Mon Sep 17 00:00:00 2001 From: kirbylife Date: Thu, 3 Oct 2019 12:52:40 -0500 Subject: [PATCH] added the section to get messages --- README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/README.md b/README.md index 7e66f87..a917926 100644 --- a/README.md +++ b/README.md @@ -33,5 +33,39 @@ Out[4]: True In [5]: email.reset_time() ``` +**Get the messages recieved** +``` +In [6]: messages = email.get_messages() +In [7]: type(messages) +Out[7]: list +In [8]: messages +Out[8]: +[{'subject': 'Subject example', + 'attachments': [], + 'formattedDate': 'Oct 3, 2019 12:46:18 PM', + 'bodyPreview': "Hello, I'm the body of the e-mail.", + 'attachmentCount': 0, + 'repliedTo': False, + 'bodyPlainText': "Hello, I'm the body of the e-mail.", + 'primaryFromAddress': 'kirbylife@protonmail.com', + 'read': False, + 'forwarded': False, + 'bodyText': "
Hello, I'm the body of the e-mail.
", + 'fromList': ['kirbylife@protonmail.com'], + 'recipientList': ['b3763093@urhen.com'], + 'sentDate': 1570124778000, + 'expanded': False, + 'id': '18326103452296378'}] +``` + +**Get the total number of messages** +``` +In [9]: email.total_messages +Out[9]: 1 +In [10]: # Another way +In [11]: len(email.messages) +Out[11]: 1 +``` + ### TO-DO - [x] Access to the e-mails received