evilmail 1.0.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.
@@ -0,0 +1,14 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+ .mypy_cache/
10
+ .ruff_cache/
11
+ .pytest_cache/
12
+ .tox/
13
+ .venv/
14
+ venv/
evilmail-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 EvilMail
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.
@@ -0,0 +1,377 @@
1
+ Metadata-Version: 2.4
2
+ Name: evilmail
3
+ Version: 1.0.0
4
+ Summary: Official Python SDK for the EvilMail API
5
+ Project-URL: Homepage, https://evilmail.pro
6
+ Project-URL: Documentation, https://evilmail.pro/docs
7
+ Project-URL: Repository, https://github.com/Evil-Mail/evilmail-python
8
+ Project-URL: Issues, https://github.com/Evil-Mail/evilmail-python/issues
9
+ Author-email: EvilMail <sdk@evilmail.pro>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: anonymous-email,api-client,custom-domain-email,disposable-email,email,email-api,email-client,email-verification,evilmail,inbox,mail,otp,privacy,random-email,sdk,temp-email,temporary-email,verification-code
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Communications :: Email
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.9
27
+ Requires-Dist: httpx<1.0.0,>=0.24.0
28
+ Description-Content-Type: text/markdown
29
+
30
+ <p align="center">
31
+ <a href="https://evilmail.pro">
32
+ <img src="https://avatars.githubusercontent.com/u/267867069?v=4" alt="EvilMail Logo" width="120" height="120" style="border-radius: 20px;">
33
+ </a>
34
+ </p>
35
+
36
+ <h1 align="center">EvilMail Python SDK</h1>
37
+
38
+ <p align="center">
39
+ <strong>Official Python client library for the <a href="https://evilmail.pro">EvilMail</a> disposable email API</strong>
40
+ </p>
41
+
42
+ <p align="center">
43
+ <a href="https://pypi.org/project/evilmail/"><img src="https://img.shields.io/pypi/v/evilmail.svg?style=flat-square&color=blue" alt="PyPI Version"></a>
44
+ <a href="https://pypi.org/project/evilmail/"><img src="https://img.shields.io/pypi/pyversions/evilmail.svg?style=flat-square" alt="Python Versions"></a>
45
+ <a href="https://pypi.org/project/evilmail/"><img src="https://img.shields.io/pypi/dm/evilmail.svg?style=flat-square&color=green" alt="Monthly Downloads"></a>
46
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square" alt="License: MIT"></a>
47
+ <a href="https://mypy-lang.org/"><img src="https://img.shields.io/badge/type--checked-mypy-blue.svg?style=flat-square" alt="Checked with mypy"></a>
48
+ </p>
49
+
50
+ <p align="center">
51
+ <a href="#installation">Installation</a> •
52
+ <a href="#quick-start">Quick Start</a> •
53
+ <a href="#async-usage">Async</a> •
54
+ <a href="#api-reference">API Reference</a> •
55
+ <a href="#error-handling">Error Handling</a> •
56
+ <a href="https://evilmail.pro/docs">Documentation</a>
57
+ </p>
58
+
59
+ ---
60
+
61
+ The **EvilMail Python SDK** provides a modern, fully-typed interface for integrating temporary email, disposable email addresses, email verification code extraction, inbox management, and custom domain email services into your Python applications. Supports both **synchronous** and **asynchronous** clients with complete type hints and dataclass response models.
62
+
63
+ ## Features
64
+
65
+ - **Sync + Async Clients** — Choose `EvilMail` or `AsyncEvilMail` based on your application architecture
66
+ - **Temporary Email** — Create anonymous disposable email addresses with configurable TTL
67
+ - **Email Verification Codes** — Auto-extract OTP codes from Google, Facebook, Instagram, TikTok, Discord, Twitter, LinkedIn, iCloud
68
+ - **Account Management** — Full CRUD for persistent email accounts on custom domains
69
+ - **Inbox Access** — Read emails, list messages, fetch full HTML & plain text content
70
+ - **Random Email Generator** — Batch create random email accounts with auto-generated passwords
71
+ - **Domain Management** — List free, premium, and custom email domains
72
+ - **Fully Typed** — Complete type hints with `py.typed` marker, `mypy --strict` compatible
73
+ - **Dataclass Models** — All API responses parsed into frozen dataclasses
74
+ - **Context Manager Support** — Automatic resource cleanup with `with` / `async with`
75
+ - **Built on httpx** — Modern, high-performance HTTP client with connection pooling
76
+
77
+ ## Installation
78
+
79
+ ```bash
80
+ pip install evilmail
81
+ ```
82
+
83
+ Requires **Python 3.9+**.
84
+
85
+ ## Quick Start
86
+
87
+ ```python
88
+ from evilmail import EvilMail
89
+
90
+ client = EvilMail("your-api-key")
91
+
92
+ # Create a temporary disposable email address
93
+ temp = client.temp_email.create(domain="evilmail.pro", ttl_minutes=60)
94
+ print(f"Temporary email: {temp.email}")
95
+ print(f"Session token: {temp.session_token}")
96
+ print(f"Expires at: {temp.expires_at}")
97
+
98
+ # Check session status
99
+ session = client.temp_email.check_session(temp.session_token)
100
+
101
+ # Read a specific message from temp inbox
102
+ message = client.temp_email.get_message(temp.session_token, uid=1)
103
+ print(f"Subject: {message.subject}")
104
+
105
+ # List inbox messages from a persistent account
106
+ messages = client.inbox.list("user@yourdomain.com")
107
+ for msg in messages:
108
+ print(f"{msg.sender}: {msg.subject}")
109
+
110
+ # Extract a Google verification code automatically
111
+ code = client.verification.get_code("google", "user@yourdomain.com")
112
+ print(f"Verification code: {code.code}")
113
+
114
+ # Batch create random email accounts
115
+ batch = client.random_email.create_batch("yourdomain.com", count=5, password_length=20)
116
+ for entry in batch.emails:
117
+ print(f"{entry.email}: {entry.password}")
118
+
119
+ client.close()
120
+ ```
121
+
122
+ ## Async Usage
123
+
124
+ ```python
125
+ import asyncio
126
+ from evilmail import AsyncEvilMail
127
+
128
+ async def main():
129
+ async with AsyncEvilMail("your-api-key") as client:
130
+ # Create temp email
131
+ temp = await client.temp_email.create(domain="evilmail.pro")
132
+ print(f"Email: {temp.email}")
133
+
134
+ # Extract verification code
135
+ code = await client.verification.get_code("google", "user@yourdomain.com")
136
+ print(f"Code: {code.code}")
137
+
138
+ # List accounts
139
+ accounts = await client.accounts.list()
140
+ for acct in accounts:
141
+ print(f"Account: {acct.email}")
142
+
143
+ asyncio.run(main())
144
+ ```
145
+
146
+ ## Authentication
147
+
148
+ All requests require an API key via the `X-API-Key` header. Get your key from the [EvilMail dashboard](https://evilmail.pro).
149
+
150
+ ```python
151
+ # Basic
152
+ client = EvilMail("your-api-key")
153
+
154
+ # With custom settings
155
+ client = EvilMail(
156
+ "your-api-key",
157
+ base_url="https://evilmail.pro", # default
158
+ timeout=60.0, # seconds, default 30
159
+ )
160
+ ```
161
+
162
+ ## Context Managers
163
+
164
+ Both clients support context managers for automatic resource cleanup:
165
+
166
+ ```python
167
+ # Synchronous
168
+ with EvilMail("your-api-key") as client:
169
+ accounts = client.accounts.list()
170
+
171
+ # Asynchronous
172
+ async with AsyncEvilMail("your-api-key") as client:
173
+ accounts = await client.accounts.list()
174
+ ```
175
+
176
+ ---
177
+
178
+ ## API Reference
179
+
180
+ ### Temporary Email
181
+
182
+ Create anonymous, disposable email addresses with automatic expiration. Perfect for sign-up verification, automated testing, and privacy protection.
183
+
184
+ #### `client.temp_email.create(*, domain=None, ttl_minutes=None)`
185
+
186
+ Create a new temporary email address.
187
+
188
+ | Parameter | Type | Required | Description |
189
+ |-----------|------|----------|-------------|
190
+ | `domain` | `str` | No | Preferred domain for the disposable address |
191
+ | `ttl_minutes` | `int` | No | Time-to-live in minutes |
192
+
193
+ Returns: `TempEmail` — `email`, `domain`, `session_token`, `ttl_minutes`, `expires_at`
194
+
195
+ #### `client.temp_email.check_session(token)`
196
+
197
+ Check if a temporary email session is still active.
198
+
199
+ #### `client.temp_email.get_message(token, uid)`
200
+
201
+ Read a specific message from a temp email inbox.
202
+
203
+ | Parameter | Type | Required | Description |
204
+ |-----------|------|----------|-------------|
205
+ | `token` | `str` | Yes | Session token from `create()` |
206
+ | `uid` | `int` | Yes | Message UID |
207
+
208
+ Returns: `Message`
209
+
210
+ #### `client.temp_email.delete(token)`
211
+
212
+ Permanently delete a temporary email session.
213
+
214
+ ---
215
+
216
+ ### Accounts
217
+
218
+ Manage persistent email accounts on custom domains.
219
+
220
+ #### `client.accounts.list()`
221
+
222
+ Returns: `list[Account]` — `email`, `domain`, `created_at`
223
+
224
+ #### `client.accounts.create(email, password)`
225
+
226
+ Returns: `CreatedAccount` — `email`
227
+
228
+ #### `client.accounts.delete(emails)`
229
+
230
+ Returns: `DeleteResult` — `deleted_count`
231
+
232
+ #### `client.accounts.change_password(email, new_password)`
233
+
234
+ ---
235
+
236
+ ### Inbox
237
+
238
+ Read emails from persistent account inboxes with full message content.
239
+
240
+ #### `client.inbox.list(email)`
241
+
242
+ Returns: `list[InboxMessage]` — `uid`, `sender`, `subject`, `date`, `seen`
243
+
244
+ #### `client.inbox.get_message(uid, email)`
245
+
246
+ Returns: `Message` — `uid`, `sender`, `subject`, `text`, `html`, `date`, `seen`
247
+
248
+ ---
249
+
250
+ ### Verification Codes
251
+
252
+ Automatically extract OTP verification codes from emails sent by popular services.
253
+
254
+ #### `client.verification.get_code(service, email)`
255
+
256
+ **Supported services:** `facebook`, `twitter`, `google`, `icloud`, `instagram`, `tiktok`, `discord`, `linkedin`
257
+
258
+ Returns: `VerificationCode` — `code`, `service`, `email`, `sender`, `subject`, `date`
259
+
260
+ ---
261
+
262
+ ### Random Email
263
+
264
+ Generate random email accounts with secure auto-generated credentials.
265
+
266
+ #### `client.random_email.preview()`
267
+
268
+ Returns: `RandomEmailPreview` — `username`, `email`, `password`, `domain`
269
+
270
+ #### `client.random_email.create_batch(domain, *, count=None, password_length=None)`
271
+
272
+ Returns: `RandomEmailBatch` — `count`, `emails: list[RandomEmailEntry]`
273
+
274
+ ---
275
+
276
+ ### Domains
277
+
278
+ List available email domains by tier.
279
+
280
+ #### `client.domains.list()`
281
+
282
+ Returns: `Domains` — `free`, `premium`, `customer`, `package_type`, `authenticated`
283
+
284
+ ---
285
+
286
+ ## Response Models
287
+
288
+ All API responses are parsed into frozen dataclasses with complete type hints:
289
+
290
+ | Model | Fields |
291
+ |-------|--------|
292
+ | `TempEmail` | `email`, `domain`, `session_token`, `ttl_minutes`, `expires_at` |
293
+ | `InboxMessage` | `uid`, `sender`, `subject`, `date`, `seen` |
294
+ | `Account` | `email`, `domain`, `created_at` |
295
+ | `CreatedAccount` | `email` |
296
+ | `DeleteResult` | `deleted_count` |
297
+ | `Message` | `uid`, `sender`, `subject`, `text`, `html`, `date`, `seen` |
298
+ | `VerificationCode` | `code`, `service`, `email`, `sender`, `subject`, `date` |
299
+ | `RandomEmailPreview` | `username`, `email`, `password`, `domain` |
300
+ | `RandomEmailEntry` | `email`, `password` |
301
+ | `RandomEmailBatch` | `count`, `emails` |
302
+ | `Domains` | `free`, `premium`, `customer`, `package_type`, `authenticated` |
303
+
304
+ ---
305
+
306
+ ## Error Handling
307
+
308
+ The SDK raises typed exceptions for precise error handling:
309
+
310
+ ```python
311
+ from evilmail import (
312
+ EvilMailError, # Base exception for all SDK errors
313
+ APIError, # Non-success HTTP response from the API
314
+ AuthenticationError, # 401 Unauthorized — invalid API key
315
+ ForbiddenError, # 403 Forbidden — insufficient permissions
316
+ NotFoundError, # 404 Not Found — resource does not exist
317
+ RateLimitError, # 429 Too Many Requests — slow down
318
+ ServerError, # 5xx Server Error — API-side issue
319
+ ConnectionError, # Network connectivity issues
320
+ TimeoutError, # Request timeout exceeded
321
+ ValidationError, # Invalid parameters (client-side validation)
322
+ )
323
+
324
+ try:
325
+ code = client.verification.get_code("google", "user@yourdomain.com")
326
+ print(f"Your code: {code.code}")
327
+ except NotFoundError:
328
+ print("No verification email found yet")
329
+ except RateLimitError as exc:
330
+ print(f"Rate limited: {exc.message}")
331
+ except AuthenticationError:
332
+ print("Invalid API key — check your credentials")
333
+ except EvilMailError as exc:
334
+ print(f"Error: {exc}")
335
+ ```
336
+
337
+ ---
338
+
339
+ ## Use Cases
340
+
341
+ - **Automated Testing & QA** — Generate disposable email addresses for end-to-end test suites with pytest, unittest, or Robot Framework
342
+ - **Web Scraping & Automation** — Create temp emails for sign-up flows in Selenium, Playwright, or Scrapy pipelines
343
+ - **Email Verification Bots** — Automatically extract OTP codes from Google, Facebook, Instagram, and more
344
+ - **Account Provisioning** — Bulk create and manage email accounts for SaaS platforms
345
+ - **Privacy & Anonymity** — Use anonymous email addresses to protect user identity
346
+ - **CI/CD Pipelines** — Integrate email testing into GitHub Actions, GitLab CI, or Jenkins workflows
347
+ - **Async Web Applications** — Native async support for FastAPI, aiohttp, and Django async views
348
+ - **Data Science & Research** — Programmatic email generation for data collection workflows
349
+
350
+ ---
351
+
352
+ ## Related SDKs
353
+
354
+ | Language | Package | Repository |
355
+ |----------|---------|------------|
356
+ | **Node.js** | `evilmail` | [Evil-Mail/evilmail-node](https://github.com/Evil-Mail/evilmail-node) |
357
+ | **PHP** | `evilmail/evilmail-php` | [Evil-Mail/evilmail-php](https://github.com/Evil-Mail/evilmail-php) |
358
+ | **Python** | `evilmail` | [Evil-Mail/evilmail-python](https://github.com/Evil-Mail/evilmail-python) |
359
+ | **Go** | `evilmail-go` | [Evil-Mail/evilmail-go](https://github.com/Evil-Mail/evilmail-go) |
360
+
361
+ ## Links
362
+
363
+ - [EvilMail Website](https://evilmail.pro) — Temporary & custom domain email platform
364
+ - [API Documentation](https://evilmail.pro/docs) — Full REST API reference
365
+ - [Chrome Extension](https://github.com/Evil-Mail/evilmail-chrome) — Disposable temp email in your browser
366
+ - [Firefox Add-on](https://github.com/Evil-Mail/evilmail-firefox) — Temp email for Firefox
367
+ - [Mobile App](https://github.com/Evil-Mail/evilmail-mobile) — Privacy-first email on Android
368
+
369
+ ## License
370
+
371
+ [MIT](LICENSE)
372
+
373
+ ## Support
374
+
375
+ - Issues: [github.com/Evil-Mail/evilmail-python/issues](https://github.com/Evil-Mail/evilmail-python/issues)
376
+ - Email: support@evilmail.pro
377
+ - Website: [evilmail.pro](https://evilmail.pro)