mail2task 0.6.0__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mail2task-0.6.0 → mail2task-0.7.0}/PKG-INFO +10 -1
- {mail2task-0.6.0 → mail2task-0.7.0}/README.md +9 -0
- {mail2task-0.6.0 → mail2task-0.7.0}/pyproject.toml +1 -1
- {mail2task-0.6.0 → mail2task-0.7.0}/src/mail2task/cli.py +6 -2
- mail2task-0.7.0/src/mail2task/email_parser.py +22 -0
- {mail2task-0.6.0 → mail2task-0.7.0}/src/mail2task.egg-info/PKG-INFO +10 -1
- {mail2task-0.6.0 → mail2task-0.7.0}/src/mail2task.egg-info/SOURCES.txt +1 -0
- {mail2task-0.6.0 → mail2task-0.7.0}/setup.cfg +0 -0
- {mail2task-0.6.0 → mail2task-0.7.0}/src/mail2task/__init__.py +0 -0
- {mail2task-0.6.0 → mail2task-0.7.0}/src/mail2task/extractor.py +0 -0
- {mail2task-0.6.0 → mail2task-0.7.0}/src/mail2task/parser.py +0 -0
- {mail2task-0.6.0 → mail2task-0.7.0}/src/mail2task.egg-info/dependency_links.txt +0 -0
- {mail2task-0.6.0 → mail2task-0.7.0}/src/mail2task.egg-info/entry_points.txt +0 -0
- {mail2task-0.6.0 → mail2task-0.7.0}/src/mail2task.egg-info/requires.txt +0 -0
- {mail2task-0.6.0 → mail2task-0.7.0}/src/mail2task.egg-info/top_level.txt +0 -0
- {mail2task-0.6.0 → mail2task-0.7.0}/tests/test_extractor.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mail2task
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: Extract actionable tasks from emails using Python
|
|
5
5
|
Author: Eby J Kavungal
|
|
6
6
|
Project-URL: Homepage, https://github.com/EbyJK/mail2task
|
|
@@ -143,6 +143,15 @@ mail2task uses spaCy for:
|
|
|
143
143
|
- action verb detection
|
|
144
144
|
- lightweight NLP parsing
|
|
145
145
|
|
|
146
|
+
## `.eml` Email Support
|
|
147
|
+
|
|
148
|
+
mail2task can process raw email files directly.
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
mail2task sample_email.eml --pretty
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
|
|
146
155
|
## Project Structure
|
|
147
156
|
|
|
148
157
|
```text
|
|
@@ -127,6 +127,15 @@ mail2task uses spaCy for:
|
|
|
127
127
|
- action verb detection
|
|
128
128
|
- lightweight NLP parsing
|
|
129
129
|
|
|
130
|
+
## `.eml` Email Support
|
|
131
|
+
|
|
132
|
+
mail2task can process raw email files directly.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
mail2task sample_email.eml --pretty
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
|
|
130
139
|
## Project Structure
|
|
131
140
|
|
|
132
141
|
```text
|
|
@@ -2,6 +2,7 @@ import argparse
|
|
|
2
2
|
import json
|
|
3
3
|
import csv
|
|
4
4
|
from .extractor import extract_tasks
|
|
5
|
+
from .email_parser import extract_email_body
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
def save_csv(tasks, output_file):
|
|
@@ -57,8 +58,11 @@ def main():
|
|
|
57
58
|
args = parser.parse_args()
|
|
58
59
|
|
|
59
60
|
try:
|
|
60
|
-
|
|
61
|
-
content
|
|
61
|
+
if args.file.endswith(".eml"):
|
|
62
|
+
content=extract_email_body(args.file)
|
|
63
|
+
else:
|
|
64
|
+
with open(args.file, "r", encoding="utf-8") as f:
|
|
65
|
+
content = f.read()
|
|
62
66
|
|
|
63
67
|
tasks = extract_tasks(content)
|
|
64
68
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from email import policy
|
|
2
|
+
from email.parser import BytesParser
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def extract_email_body(file_path: str):
|
|
6
|
+
with open(file_path, "rb") as f:
|
|
7
|
+
msg = BytesParser(policy=policy.default).parse(f)
|
|
8
|
+
|
|
9
|
+
# Prefer plain text body
|
|
10
|
+
if msg.is_multipart():
|
|
11
|
+
|
|
12
|
+
for part in msg.walk():
|
|
13
|
+
|
|
14
|
+
content_type = part.get_content_type()
|
|
15
|
+
|
|
16
|
+
if content_type == "text/plain":
|
|
17
|
+
return part.get_content()
|
|
18
|
+
|
|
19
|
+
else:
|
|
20
|
+
return msg.get_content()
|
|
21
|
+
|
|
22
|
+
return ""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mail2task
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: Extract actionable tasks from emails using Python
|
|
5
5
|
Author: Eby J Kavungal
|
|
6
6
|
Project-URL: Homepage, https://github.com/EbyJK/mail2task
|
|
@@ -143,6 +143,15 @@ mail2task uses spaCy for:
|
|
|
143
143
|
- action verb detection
|
|
144
144
|
- lightweight NLP parsing
|
|
145
145
|
|
|
146
|
+
## `.eml` Email Support
|
|
147
|
+
|
|
148
|
+
mail2task can process raw email files directly.
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
mail2task sample_email.eml --pretty
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
|
|
146
155
|
## Project Structure
|
|
147
156
|
|
|
148
157
|
```text
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|