openmail 0.1.5__py3-none-any.whl

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.
Files changed (67) hide show
  1. openmail/__init__.py +6 -0
  2. openmail/assistants/__init__.py +35 -0
  3. openmail/assistants/classify_emails.py +83 -0
  4. openmail/assistants/compose_email.py +43 -0
  5. openmail/assistants/detect_phishing_for_email.py +61 -0
  6. openmail/assistants/evaluate_sender_trust_for_email.py +59 -0
  7. openmail/assistants/extract_tasks_from_emails.py +126 -0
  8. openmail/assistants/generate_follow_up_for_email.py +54 -0
  9. openmail/assistants/natural_language_query.py +699 -0
  10. openmail/assistants/prioritize_emails.py +89 -0
  11. openmail/assistants/reply.py +58 -0
  12. openmail/assistants/reply_suggestions.py +46 -0
  13. openmail/assistants/rewrite_email.py +50 -0
  14. openmail/assistants/summarize_attachments_for_email.py +101 -0
  15. openmail/assistants/summarize_thread_emails.py +55 -0
  16. openmail/assistants/summary.py +44 -0
  17. openmail/assistants/summary_multi.py +57 -0
  18. openmail/assistants/translate_email.py +54 -0
  19. openmail/auth/__init__.py +6 -0
  20. openmail/auth/base.py +34 -0
  21. openmail/auth/no_auth.py +19 -0
  22. openmail/auth/oauth2.py +58 -0
  23. openmail/auth/password.py +26 -0
  24. openmail/config.py +26 -0
  25. openmail/email_assistant.py +418 -0
  26. openmail/email_manager.py +777 -0
  27. openmail/email_query.py +279 -0
  28. openmail/errors.py +16 -0
  29. openmail/imap/__init__.py +5 -0
  30. openmail/imap/attachment_parts.py +55 -0
  31. openmail/imap/bodystructure.py +296 -0
  32. openmail/imap/client.py +806 -0
  33. openmail/imap/fetch_response.py +115 -0
  34. openmail/imap/inline_cid.py +106 -0
  35. openmail/imap/pagination.py +16 -0
  36. openmail/imap/parser.py +298 -0
  37. openmail/imap/query.py +233 -0
  38. openmail/llm/__init__.py +3 -0
  39. openmail/llm/claude.py +35 -0
  40. openmail/llm/costs.py +108 -0
  41. openmail/llm/gemini.py +34 -0
  42. openmail/llm/gpt.py +33 -0
  43. openmail/llm/groq.py +36 -0
  44. openmail/llm/model.py +126 -0
  45. openmail/llm/xai.py +35 -0
  46. openmail/logger.py +20 -0
  47. openmail/models/__init__.py +20 -0
  48. openmail/models/attachment.py +128 -0
  49. openmail/models/message.py +113 -0
  50. openmail/models/subscription.py +45 -0
  51. openmail/models/task.py +24 -0
  52. openmail/py.typed +0 -0
  53. openmail/smtp/__init__.py +7 -0
  54. openmail/smtp/builder.py +41 -0
  55. openmail/smtp/client.py +218 -0
  56. openmail/smtp/templates.py +16 -0
  57. openmail/subscription/__init__.py +7 -0
  58. openmail/subscription/detector.py +58 -0
  59. openmail/subscription/parser.py +32 -0
  60. openmail/subscription/service.py +237 -0
  61. openmail/types.py +30 -0
  62. openmail/utils/__init__.py +39 -0
  63. openmail/utils/utils.py +295 -0
  64. openmail-0.1.5.dist-info/METADATA +180 -0
  65. openmail-0.1.5.dist-info/RECORD +67 -0
  66. openmail-0.1.5.dist-info/WHEEL +4 -0
  67. openmail-0.1.5.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.4
2
+ Name: openmail
3
+ Version: 0.1.5
4
+ Summary: API for managing your email
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.8
7
+ Requires-Dist: beautifulsoup4
8
+ Requires-Dist: langchain
9
+ Requires-Dist: langchain-anthropic
10
+ Requires-Dist: langchain-core
11
+ Requires-Dist: langchain-google-genai
12
+ Requires-Dist: langchain-groq
13
+ Requires-Dist: langchain-openai
14
+ Requires-Dist: langchain-xai
15
+ Requires-Dist: pydantic
16
+ Requires-Dist: requests
17
+ Provides-Extra: dev
18
+ Requires-Dist: black; extra == 'dev'
19
+ Requires-Dist: ruff; extra == 'dev'
20
+ Provides-Extra: test
21
+ Requires-Dist: pytest; extra == 'test'
22
+ Provides-Extra: web
23
+ Requires-Dist: fastapi[standard]; extra == 'web'
24
+ Requires-Dist: jinja2; extra == 'web'
25
+ Requires-Dist: python-dotenv; extra == 'web'
26
+ Requires-Dist: python-multipart; extra == 'web'
27
+ Requires-Dist: uvicorn; extra == 'web'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # OpenMail
31
+
32
+ OpenMail is a lightweight, extensible Python toolkit for working with email systems using **IMAP** (reading, searching, triage) and **SMTP** (sending and composing), with optional **LLM-powered assistance** for summarization, replies, prioritization, and intelligent search.
33
+
34
+ The package is designed with a clean separation of concerns:
35
+ - **Transport**: IMAP and SMTP clients
36
+ - **Coordination**: a single high-level manager
37
+ - **Query building**: fluent, lazy IMAP queries
38
+ - **Intelligence**: optional LLM-based workflows
39
+
40
+ OpenMail is suitable for building inbox tools, assistants, dashboards, CRMs, helpdesks, or personal productivity systems.
41
+
42
+ ---
43
+
44
+ ## 📦 Installation
45
+
46
+ ```
47
+ pip install openmail
48
+ ```
49
+
50
+ ---
51
+
52
+ ## 🧱 Package Architecture
53
+
54
+ OpenMail exposes three main high-level components:
55
+
56
+ | Component | Purpose |
57
+ |---|---|
58
+ | **EmailManager** | Coordinates IMAP & SMTP for sending, fetching, replying, forwarding, and mailbox operations |
59
+ | **EmailQuery** | Fluent, lazy IMAP query builder |
60
+ | **EmailAssistant** | Optional LLM-powered assistant for summarization, replies, search, and analysis |
61
+
62
+ Each component is documented in detail in its own markdown file.
63
+ This document only provides a **high-level overview and initialization examples**.
64
+
65
+ ---
66
+
67
+ ## 🔌 EmailManager
68
+
69
+ `EmailManager` is the central orchestration layer.
70
+ It combines an IMAP client and an SMTP client into a single, consistent API.
71
+
72
+ ### Basic Initialization
73
+
74
+ ```
75
+ from openmail.smtp import SMTPClient
76
+ from openmail.imap import IMAPClient
77
+ from openmail.auth import PasswordAuth
78
+ from openmail import EmailManager
79
+
80
+ auth = PasswordAuth(
81
+ username="you@example.com",
82
+ password="app_password",
83
+ )
84
+
85
+ imap = IMAPClient(
86
+ host="imap.example.com",
87
+ port=993,
88
+ auth=auth,
89
+ )
90
+
91
+ smtp = SMTPClient(
92
+ host="smtp.example.com",
93
+ port=587,
94
+ auth=auth,
95
+ )
96
+
97
+ manager = EmailManager(
98
+ imap=imap,
99
+ smtp=smtp,
100
+ )
101
+ ```
102
+
103
+ `EmailManager` is responsible for:
104
+ - Sending and composing messages
105
+ - Fetching messages and threads
106
+ - Replying, reply-all, forwarding
107
+ - Flags, folders, triage, unsubscribe helpers
108
+
109
+ ➡️ See [docs/EmailManager.md](docs/EmailManager.md) for the full API and workflows.
110
+
111
+ ---
112
+
113
+ ## 🔎 EmailQuery
114
+
115
+ `EmailQuery` is a fluent builder for IMAP searches.
116
+ It is **lazy**: no IMAP call is made until you execute the query.
117
+
118
+ ### Basic Initialization
119
+
120
+ You normally create it from `EmailManager`:
121
+
122
+ ```
123
+ q = manager.imap_query(mailbox="INBOX")
124
+ ```
125
+
126
+ ### Example Usage
127
+
128
+ ```
129
+ q = (
130
+ manager.imap_query()
131
+ .from_any("alerts@example.com")
132
+ .recent_unread(7)
133
+ )
134
+
135
+ page, messages = q.fetch()
136
+ ```
137
+
138
+ `EmailQuery` focuses only on **search construction and execution**.
139
+
140
+ ➡️ See [docs/EmailQuery.md](docs/EmailQuery.md) for all available filters and execution options.
141
+
142
+ ---
143
+
144
+ ## 🤖 EmailAssistant
145
+
146
+ `EmailAssistant` provides optional **LLM-powered intelligence** on top of email data.
147
+ It does not send or fetch emails by itself; it operates on `EmailMessage` objects.
148
+
149
+ ### Basic Initialization
150
+
151
+ ```
152
+ from openmail import EmailAssistant
153
+
154
+ assistant = EmailAssistant()
155
+ ```
156
+
157
+ ### With Persona Customization
158
+
159
+ ```
160
+ from openmail import EmailAssistant, EmailAssistantProfile
161
+
162
+ profile = EmailAssistantProfile(
163
+ name="Alex",
164
+ role="Support Engineer",
165
+ company="ExampleCorp",
166
+ tone="friendly",
167
+ )
168
+
169
+ assistant = EmailAssistant(profile=profile)
170
+ ```
171
+
172
+ `EmailAssistant` supports:
173
+ - Email summarization (single, multi, thread)
174
+ - Reply and follow-up generation
175
+ - Task extraction
176
+ - Prioritization and classification
177
+ - Natural-language IMAP search construction
178
+ - Phishing detection and sender trust evaluation
179
+
180
+ ➡️ See [docs/EmailAssistant.md](docs/EmailAssistant.md) for supported providers, models, and all methods.
@@ -0,0 +1,67 @@
1
+ openmail/__init__.py,sha256=kQtfm2PqEiq8OEXjqJbJIrmcvTDIXjGLywvfzndffqg,283
2
+ openmail/config.py,sha256=ucT1dF-0uJmc47DMIuFaVoWFE1yDrY6od18oTVICuXI,542
3
+ openmail/email_assistant.py,sha256=hZBFjAPdqpda3Y1Yp1N0oGdQd4iJoznrCqJooIzeblo,11806
4
+ openmail/email_manager.py,sha256=HiXdltGiHdBWPjwge5zeBctKNtn7UbWKGhC7YKHKmwc,23778
5
+ openmail/email_query.py,sha256=aMvvA0xChkj6TEcs-jbI5KA668gB6RMusV4iG5aQZF0,8297
6
+ openmail/errors.py,sha256=SdqxFcEMR5SJZZ2jeBcOvbtrGtiK9atTNiomS-RI6Uc,253
7
+ openmail/logger.py,sha256=CLpcGg3i9V9VQB9tyBRbzYHApaA_UGUQ3JB4PiQnrXc,521
8
+ openmail/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ openmail/types.py,sha256=DpojiorsNJUF62jkwgrVg2Zmi-ARgMTmTWLko2GsHiI,596
10
+ openmail/assistants/__init__.py,sha256=AntEtNQV42ADPzhlzIui-z0t138QUW0Guh9rmqgWZ4E,1819
11
+ openmail/assistants/classify_emails.py,sha256=G79mrVURMx8xKiIawX-3be7LdxZuDL4sceTUrzU79kQ,2309
12
+ openmail/assistants/compose_email.py,sha256=ytytyjhYWljpdtt2Nq3feUhLaLat_57U_kIJUjpA7m0,1194
13
+ openmail/assistants/detect_phishing_for_email.py,sha256=DGVqVaoKuBQ2Ks1pYmRVGwrZXoqJUdecAL53dP8ZMyw,1886
14
+ openmail/assistants/evaluate_sender_trust_for_email.py,sha256=GKftmMoGRXUfEWeEfbykt7hzKUKiby9yanRlaXrm1M8,1831
15
+ openmail/assistants/extract_tasks_from_emails.py,sha256=Mnf0oGpMuA9d65gyHzB6rri3YG5lrzleqQBXI31idf8,4253
16
+ openmail/assistants/generate_follow_up_for_email.py,sha256=tgmvOeI8tFPE20x8cpYcWBvavWYkJnOyFzhkCkxq6qc,1465
17
+ openmail/assistants/natural_language_query.py,sha256=1zzFhqU58SqQFFsKNeJRmPAvtXJlBn3jRNuZ8BRA5Yk,23313
18
+ openmail/assistants/prioritize_emails.py,sha256=NI9HYwuOvpi6rjqJnoITT2fqfpUVi8_i95uVVeGl00M,2523
19
+ openmail/assistants/reply.py,sha256=nXWRgcXrLq-6BeJp6GWT_ALcZT-8Rw0vzeAxlEZZTw4,1606
20
+ openmail/assistants/reply_suggestions.py,sha256=5_XgOwJeP1kjAapp4OVH6oi4Nh0KFQlTC2pQKUjOkE8,1350
21
+ openmail/assistants/rewrite_email.py,sha256=HtEKG9qYVlhe16nskrrXHGnpBKtZjKf9SXiHDgjx4dQ,1266
22
+ openmail/assistants/summarize_attachments_for_email.py,sha256=_UdGKavZ9xiQ9MJ5N8XcU5SlNKfP1S2pl6xImS3QCPo,2944
23
+ openmail/assistants/summarize_thread_emails.py,sha256=kUSoNDMp_14XEoNJznMmxiSG2HoQddgGBA1O2aJCNv4,1614
24
+ openmail/assistants/summary.py,sha256=1n85A9yCr-ufXz02-aJ-jdjlmvgfph2ty6zh1EpXlTk,1162
25
+ openmail/assistants/summary_multi.py,sha256=DQ44LPKQaySxJWBs959gB9adDx_Uvi9crr02JHNhNnY,1572
26
+ openmail/assistants/translate_email.py,sha256=FOFUXnpeWoV-4wkfQdllsRF9hhdxAt7qpW4n3ugSWMY,1411
27
+ openmail/auth/__init__.py,sha256=mi-R50ziAvG20DaCkMoFXyVR5LZrt12NddES7j5k618,287
28
+ openmail/auth/base.py,sha256=Kw-pCOqtijn5d2YqDZDIEzgCG6F4oEkmuzD9yR7xBjo,737
29
+ openmail/auth/no_auth.py,sha256=X0d-Amz4jYBeGfDJ9yBXzJ4ztHCj5GNrWLLWKnDxQzs,455
30
+ openmail/auth/oauth2.py,sha256=pmTDgGbR35Pxd13ANZk_-n8q_HJS2p0K7QtjOWRwc1M,1991
31
+ openmail/auth/password.py,sha256=VbjtwcC4t7q2u5rmvctMbINGqe87qpRY4oZvHLw87O0,782
32
+ openmail/imap/__init__.py,sha256=Ah1yUW4h9OkYM5v1rO666IgwCGD50ZzS8-CQeltsuXQ,201
33
+ openmail/imap/attachment_parts.py,sha256=qeRBLk4EEKNgYcFR-1tDVOMZ56B2cqcICxDpqoorfcw,1775
34
+ openmail/imap/bodystructure.py,sha256=TqaZH2_n2pn7ayvUL7eMhmfvdPJjU6g-NLAcivuTeCk,8866
35
+ openmail/imap/client.py,sha256=qmioHgvufxPOwICdPwLlQS8Rr4UlaUJPKYfGerqP0vg,28394
36
+ openmail/imap/fetch_response.py,sha256=xJzyvew2-7TGbYNcb2ZITmdlV5KQ4fs4wxxn2sfPw18,3327
37
+ openmail/imap/inline_cid.py,sha256=_Tb6B4WtQyUjQhmtR7xpLdgvMTQoASyPCkBIxNfy6rg,2841
38
+ openmail/imap/pagination.py,sha256=hwCxt-tERiXpoYMcgO1p6oLLnaboGj2EQ_ps4Z367Ok,413
39
+ openmail/imap/parser.py,sha256=0_b9CEqEzvnVxesrB_OuvTpQXlPNJw6Kaf9HbnIZONs,9785
40
+ openmail/imap/query.py,sha256=BSA0Z5gS2RLssRb4HuP9H-0ThIMy2C4DuRSBsPD4fiQ,6128
41
+ openmail/llm/__init__.py,sha256=UyVDb6OUz1OAFVxPB3ev_E0760hxSday5wD1my99vqc,66
42
+ openmail/llm/claude.py,sha256=zYHKe3CZhp9GClhl759IH8MSx7hkzvx8CiIEOtBuQ70,880
43
+ openmail/llm/costs.py,sha256=vDgeVdHtfu3cBlTuFtw0rlIl7X5bkvOHD7bO0BdcCes,4647
44
+ openmail/llm/gemini.py,sha256=nhasXz-sny6IEdI8ig63DimeG6pKXTrQNkg7IPyOHgI,945
45
+ openmail/llm/gpt.py,sha256=6495mfPCaWb1RaaomTEod9Q0jKgOMic7KU0ozSiBLaE,869
46
+ openmail/llm/groq.py,sha256=DH5Y4nHgCGaVhC5iRmV6fa_5tc_sEi9q5GtYq5FaT5A,911
47
+ openmail/llm/model.py,sha256=ZbKS8UQzcgBaP8oElEO0JARWRa6OvqT1vcKkFj1Jmwk,4445
48
+ openmail/llm/xai.py,sha256=rPZ4bACcYFCIG-_Y77ZTUV4jrWqxsuDp7Grrjdr0GrA,859
49
+ openmail/models/__init__.py,sha256=vjXN7gq2L76wXtJxDLYl2gFr6WNIFDfgnXOa8KZ71xc,517
50
+ openmail/models/attachment.py,sha256=3cJObSYRNT8pOfWtXU1buYELTYa7Pks6wPnv5Lk7z9A,4184
51
+ openmail/models/message.py,sha256=qTXN2Z_6xhEau31_c3ixK-J8YhnjV2Hw3vsiqjDET4A,3455
52
+ openmail/models/subscription.py,sha256=_hjYiV51dIZNL3iGgWSi56Ng5psDGhlCMhq92UW00uU,1106
53
+ openmail/models/task.py,sha256=4B0hYtqJvKDzOOkx81Ly5RviipgHUUpXGUm9lf-KEkw,683
54
+ openmail/smtp/__init__.py,sha256=VQC2DFBjUSDJyAXe8HSzvS4ZhW5otbt_-mzVXooSCF0,154
55
+ openmail/smtp/builder.py,sha256=nzwLmY2cZTG-3vdBR9mLM37bYLPzLM3DAdYhIAl5Ftw,1246
56
+ openmail/smtp/client.py,sha256=68S8Laybyyc71FkypOUsrIh5juhOtHfJpGDWNx-MGLg,7626
57
+ openmail/smtp/templates.py,sha256=aWxdLbWDaZKZCc5cVXX0zFmvVYj7JnypvUzujeOVz18,448
58
+ openmail/subscription/__init__.py,sha256=-dHRDCFMHZF-Eui6Vcyin9WHDUCdXTkBkNi0fqHmq-Q,196
59
+ openmail/subscription/detector.py,sha256=9FkjX18C6d4BwGom0CdpEtFyf8pFW1OXsmxMe9B_J0M,1559
60
+ openmail/subscription/parser.py,sha256=zeuorhc_WeY-5ohE4dk7vBTPBkX6SUveOKsvFQ9J-0k,821
61
+ openmail/subscription/service.py,sha256=brpjPFE2gGRLonQGsipx_Omptde2z8EVDwbEDD7CzhA,7872
62
+ openmail/utils/__init__.py,sha256=fS-5nzamMwi657FiO2xUyrkp2_twYa0EOh1A0KwkMN0,850
63
+ openmail/utils/utils.py,sha256=CuxTLKVruYuL4SXXyTwBj_Yy7E0BEr052S0SlYAnHcs,8601
64
+ openmail-0.1.5.dist-info/METADATA,sha256=1cujOBC9u7tqMi0tNjJAEJEOxTgi6PlxNuEEn9tlFqI,4575
65
+ openmail-0.1.5.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
66
+ openmail-0.1.5.dist-info/licenses/LICENSE,sha256=2htf3uSWeEqDLhxmsfC_sIw2GI6mlS4-qsMGR_9mxok,1066
67
+ openmail-0.1.5.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Luigi Liu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.