MAIF / melusine

📧 Melusine: Use python to automatize your email processing workflow
https://maif.github.io/melusine
Other
352 stars 58 forks source link

✨ Introduce GmailConnector to deal with gmail mailbox using Melusine #175

Closed MathisNcl closed 3 months ago

MathisNcl commented 6 months ago

Description

Like its cousin, the exchange box connector, the idea is to create a wrapper that will enable a Melusine user to connect to his gmail box and analyze it. Starting from the exchange connector, most of the methods have been adapted to move in the same direction. The gmail box works slightly differently. There are no folders as such, but rather labels, which function like views. The INBOX label corresponds to the complete mailbox, TRASH to the garbage... Users can create new labels. The Gmail connector lets you connect, read e-mails with a label and date filter, move them around, extract relevant information into a pandas dataframe that can be used by Melusine, and send e-mails.

Fixes #174

Type of change

How Has This Been Tested?

I Implemented all unit tests for GmailConnector. To test with your own mailbox, please follow these steps:

gc = GmailConnector(done_label="test")

Follow instructions to connect to the right mailbox. Please make sure while following the medium post that this email is in the allowed testing emails.

```python
df = gc.get_emails(5)
gc.create_label("USECASE1")
gc.create_label("USECASE2")
df["target"] = ["INBOX", "TRASH", "USECASE1", "USECASE2", "TRASH"]
gc.route_emails(df)
gc.move_to_done([df.iloc[0]["message_id"]])

Test Configuration:

Checklist: