|
1 | | -# Store mails in your inbox in csv format |
2 | | -<!--Remove the below lines and add yours --> |
3 | | -1)This script takes your email and password as input. |
4 | | - |
5 | | -2)Return a csv containing following attributes: |
6 | | - |
7 | | --Date |
8 | | - |
9 | | --From(Sender) |
10 | | - |
11 | | --Subject |
12 | | - |
13 | | --Mail Text |
14 | | - |
15 | | - |
16 | | -## Prerequisites |
17 | | -<!--Remove the below lines and add yours --> |
18 | | -You only need Python to run this script. You can visit [here](https://www.python.org/downloads/) to download Python. |
19 | | - |
20 | | - |
21 | | -## How to run the script |
22 | | -<!--Remove the below lines and add yours --> |
23 | | -Running the script is really simple! Just open a terminal in the folder where your script is located and run the following command : |
24 | | - |
25 | | - `pip install -r requirements.txt` |
26 | | - `python store_emails.py` |
27 | | - |
28 | | - |
29 | | -## *Author Name* |
30 | | -<!--Remove the below lines and add yours --> |
31 | | -gpriya32(Priyanka) |
| 1 | +# Store emails in CSV |
| 2 | + |
| 3 | +This project contains a simple script to extract email messages |
| 4 | +from an IMAP server. |
| 5 | + |
| 6 | +The messages are written to a simple four-column CSV file. |
| 7 | + |
| 8 | + |
| 9 | +## Dependencies |
| 10 | + |
| 11 | +This depends on the BeautifulSoup library |
| 12 | +for extracting text from HTML messages. |
| 13 | + |
| 14 | + |
| 15 | +## Running the script |
| 16 | + |
| 17 | +You will need to have a file `credentials.txt` |
| 18 | +with your IMAP server account name and password on separate lines. |
| 19 | + |
| 20 | +This generates `mails.csv` in the current directory. |
| 21 | + |
| 22 | +``` |
| 23 | +python store_emails.py |
| 24 | +``` |
| 25 | + |
| 26 | +The generate CSV file contains the following fields for each message: |
| 27 | + |
| 28 | +* Date |
| 29 | +* From (Sender) |
| 30 | +* Subject |
| 31 | +* Message text |
| 32 | + |
| 33 | + |
| 34 | +## Development ideas |
| 35 | + |
| 36 | +This hardcodes the IMAP server for Gmail.com and the `"INBOX"` folder. |
| 37 | +Perhaps this should be configured outside of the code |
| 38 | +for easier customization. |
| 39 | + |
| 40 | +This brutally marks all messages as read. |
| 41 | +Perhaps make it `PEEK` so as to not change the message flags. |
| 42 | + |
| 43 | +This will read everything in the `INBOX` folder. |
| 44 | +It could be useful to make it remember which messages it has already seen, |
| 45 | +and update a CSV file only with information from messages which have |
| 46 | +arrived since the previous poll. |
| 47 | + |
| 48 | +It might be useful to be able to specify which messages to fetch, |
| 49 | +instead of have it fetch everything every time. |
| 50 | + |
| 51 | + |
| 52 | +## Author Name |
| 53 | + |
| 54 | +Aditya Jetely (@AdityaJ7) |
0 commit comments