myl 0.9.3__tar.gz → 0.9.5__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.
- {myl-0.9.3 → myl-0.9.5}/PKG-INFO +4 -3
- {myl-0.9.3 → myl-0.9.5}/myl.egg-info/PKG-INFO +4 -3
- {myl-0.9.3 → myl-0.9.5}/myl.egg-info/requires.txt +1 -1
- {myl-0.9.3 → myl-0.9.5}/myl.py +45 -4
- {myl-0.9.3 → myl-0.9.5}/pyproject.toml +1 -1
- myl-0.9.5/version.txt +1 -0
- myl-0.9.3/version.txt +0 -1
- {myl-0.9.3 → myl-0.9.5}/.github/dependabot.yml +0 -0
- {myl-0.9.3 → myl-0.9.5}/.github/workflows/lint.yaml +0 -0
- {myl-0.9.3 → myl-0.9.5}/.github/workflows/pypi.yaml +0 -0
- {myl-0.9.3 → myl-0.9.5}/.github/workflows/release.yaml +0 -0
- {myl-0.9.3 → myl-0.9.5}/.gitignore +0 -0
- {myl-0.9.3 → myl-0.9.5}/LICENSE +0 -0
- {myl-0.9.3 → myl-0.9.5}/README.md +0 -0
- {myl-0.9.3 → myl-0.9.5}/flake.lock +0 -0
- {myl-0.9.3 → myl-0.9.5}/flake.nix +0 -0
- {myl-0.9.3 → myl-0.9.5}/myl.egg-info/SOURCES.txt +0 -0
- {myl-0.9.3 → myl-0.9.5}/myl.egg-info/dependency_links.txt +0 -0
- {myl-0.9.3 → myl-0.9.5}/myl.egg-info/entry_points.txt +0 -0
- {myl-0.9.3 → myl-0.9.5}/myl.egg-info/top_level.txt +0 -0
- {myl-0.9.3 → myl-0.9.5}/setup.cfg +0 -0
{myl-0.9.3 → myl-0.9.5}/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: myl
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.5
|
4
4
|
Summary: Dead simple IMAP CLI client
|
5
5
|
Author-email: Philipp Schmitt <philipp@schmitt.co>
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
@@ -689,8 +689,9 @@ Description-Content-Type: text/markdown
|
|
689
689
|
License-File: LICENSE
|
690
690
|
Requires-Dist: imap-tools<2.0.0,>=1.5.0
|
691
691
|
Requires-Dist: myl-discovery>=0.6.1.dev0
|
692
|
-
Requires-Dist: rich<
|
692
|
+
Requires-Dist: rich<15.0.0,>=13.0.0
|
693
693
|
Requires-Dist: html2text>=2024.2.26
|
694
|
+
Dynamic: license-file
|
694
695
|
|
695
696
|
# 📧 myl
|
696
697
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: myl
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.5
|
4
4
|
Summary: Dead simple IMAP CLI client
|
5
5
|
Author-email: Philipp Schmitt <philipp@schmitt.co>
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
@@ -689,8 +689,9 @@ Description-Content-Type: text/markdown
|
|
689
689
|
License-File: LICENSE
|
690
690
|
Requires-Dist: imap-tools<2.0.0,>=1.5.0
|
691
691
|
Requires-Dist: myl-discovery>=0.6.1.dev0
|
692
|
-
Requires-Dist: rich<
|
692
|
+
Requires-Dist: rich<15.0.0,>=13.0.0
|
693
693
|
Requires-Dist: html2text>=2024.2.26
|
694
|
+
Dynamic: license-file
|
694
695
|
|
695
696
|
# 📧 myl
|
696
697
|
|
{myl-0.9.3 → myl-0.9.5}/myl.py
RENAMED
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
from importlib.metadata import version, PackageNotFoundError
|
5
5
|
import argparse
|
6
|
+
import base64
|
6
7
|
import logging
|
7
8
|
import ssl
|
8
9
|
import sys
|
@@ -59,7 +60,17 @@ def mail_to_dict(msg, date_format="%Y-%m-%d %H:%M:%S"):
|
|
59
60
|
"html": msg.html,
|
60
61
|
"text": msg.text,
|
61
62
|
},
|
62
|
-
"attachments":
|
63
|
+
"attachments": [
|
64
|
+
{
|
65
|
+
"filename": x.filename,
|
66
|
+
"content_id": x.content_id,
|
67
|
+
"content_type": x.content_type,
|
68
|
+
"content_disposition": x.content_disposition,
|
69
|
+
"payload": base64.b64encode(x.payload).decode("utf-8"),
|
70
|
+
"size": x.size,
|
71
|
+
}
|
72
|
+
for x in msg.attachments
|
73
|
+
],
|
63
74
|
}
|
64
75
|
|
65
76
|
|
@@ -98,6 +109,17 @@ def parse_args():
|
|
98
109
|
default=None,
|
99
110
|
)
|
100
111
|
|
112
|
+
# get most recent email
|
113
|
+
last_parser = subparsers.add_parser(
|
114
|
+
"last", aliases=["-1"], help="Retrieve the most recent email"
|
115
|
+
)
|
116
|
+
last_parser.add_argument(
|
117
|
+
"ATTACHMENT",
|
118
|
+
help="Name of the attachment to fetch",
|
119
|
+
nargs="?",
|
120
|
+
default=None,
|
121
|
+
)
|
122
|
+
|
101
123
|
# Delete email command
|
102
124
|
delete_parser = subparsers.add_parser("delete", help="Delete an email")
|
103
125
|
delete_parser.add_argument(
|
@@ -301,15 +323,23 @@ def mb_connect(console, args) -> BaseMailBox:
|
|
301
323
|
|
302
324
|
def display_single_mail(
|
303
325
|
mailbox: BaseMailBox,
|
304
|
-
mail_id: int,
|
326
|
+
mail_id: int | None = None,
|
305
327
|
attachment: str | None = None,
|
306
328
|
mark_seen: bool = False,
|
307
329
|
raw: bool = False,
|
308
330
|
html: bool = False,
|
309
331
|
json: bool = False,
|
310
332
|
):
|
311
|
-
|
312
|
-
|
333
|
+
if mail_id is None:
|
334
|
+
LOGGER.debug("No mail_id provided, fetching the most recent mail")
|
335
|
+
msg = next(
|
336
|
+
mailbox.fetch(
|
337
|
+
"ALL", reverse=True, bulk=True, limit=1, mark_seen=mark_seen
|
338
|
+
)
|
339
|
+
)
|
340
|
+
else:
|
341
|
+
LOGGER.debug("Fetch mail %s", mail_id)
|
342
|
+
msg = next(mailbox.fetch(f"UID {mail_id}", mark_seen=mark_seen))
|
313
343
|
LOGGER.debug("Fetched mail %s", msg)
|
314
344
|
|
315
345
|
if attachment:
|
@@ -476,6 +506,17 @@ def main() -> int:
|
|
476
506
|
json=args.json,
|
477
507
|
)
|
478
508
|
|
509
|
+
elif args.command in ["-1", "last"]:
|
510
|
+
return display_single_mail(
|
511
|
+
mailbox=mailbox,
|
512
|
+
mail_id=None,
|
513
|
+
attachment=args.ATTACHMENT,
|
514
|
+
mark_seen=args.mark_seen,
|
515
|
+
raw=args.raw,
|
516
|
+
html=args.html,
|
517
|
+
json=args.json,
|
518
|
+
)
|
519
|
+
|
479
520
|
# mark emails as read
|
480
521
|
elif args.command in ["read"]:
|
481
522
|
return mark_read(
|
myl-0.9.5/version.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.9.5
|
myl-0.9.3/version.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.9.3
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{myl-0.9.3 → myl-0.9.5}/LICENSE
RENAMED
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
|