mailkite-dev 0.4.0__tar.gz → 0.5.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mailkite-dev
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: Official MailKite SDK for Python — send and manage email over your own authenticated domain.
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://mailkite.dev/docs/libraries
@@ -22,7 +22,7 @@ DEFAULT_BASE_URL = "https://api.mailkite.dev"
22
22
  # Reject webhook events older than this (ms) to block replays. Pass 0 to disable.
23
23
  DEFAULT_TOLERANCE_MS = 5 * 60 * 1000
24
24
 
25
- __all__ = ["MailKite", "MailKiteError", "verify_webhook", "reply_ok", "encrypt", "decrypt"]
25
+ __all__ = ["MailKite", "MailKiteError", "verify_webhook", "reply_ok", "reply_spam", "reply_drop", "reply_block_sender", "encrypt", "decrypt"]
26
26
 
27
27
 
28
28
  def verify_webhook(signature, payload, secret, toleranceMs=DEFAULT_TOLERANCE_MS):
@@ -61,6 +61,28 @@ def reply_ok():
61
61
  return '{"status":"ok"}'
62
62
 
63
63
 
64
+ def reply_spam():
65
+ """Control-mode reply telling MailKite to mark the message as spam.
66
+
67
+ Returns the exact string ``{"status":"spam"}``. No network call."""
68
+ return '{"status":"spam"}'
69
+
70
+
71
+ def reply_drop():
72
+ """Control-mode reply telling MailKite to drop (discard) the message.
73
+
74
+ Returns the exact string ``{"status":"drop"}``. No network call."""
75
+ return '{"status":"drop"}'
76
+
77
+
78
+ def reply_block_sender():
79
+ """Control-mode reply telling MailKite to block the sender.
80
+
81
+ Returns the exact string ``{"status":"ok","actions":[{"type":"block-sender"}]}``.
82
+ No network call."""
83
+ return '{"status":"ok","actions":[{"type":"block-sender"}]}'
84
+
85
+
64
86
  def encrypt(plaintext, public_key):
65
87
  """Encrypt a UTF-8 string to a MailKite at-rest envelope (JSON string).
66
88
 
@@ -167,6 +189,15 @@ class MailKite:
167
189
  and ``templateData`` (dict) to supply its variables."""
168
190
  return self.request("POST", "/v1/send", message)
169
191
 
192
+ def uploadAttachment(self, file):
193
+ """Upload a file (base64 ``content``) and get back a secure,
194
+ time-limited URL to reference as a send() attachment
195
+ (``{ filename, url }``) or link inline — instead of base64-inlining
196
+ large files on every send. ``file`` is a dict with ``filename`` and
197
+ ``content`` (base64 str), plus optional ``contentType`` and
198
+ ``retentionDays`` (7 | 30 | 90 | 365, default 7)."""
199
+ return self.request("POST", "/v1/attachments", file)
200
+
170
201
  def agent(self, message):
171
202
  """Send a message to an AI agent inbox. ``message`` is a dict with
172
203
  ``text`` (required) and optional ``subject``, ``from``, ``html``,
@@ -251,6 +282,21 @@ class MailKite:
251
282
  :func:`reply_ok`."""
252
283
  return reply_ok()
253
284
 
285
+ def reply_spam(self):
286
+ """Control-mode reply marking the message as spam. See module-level
287
+ :func:`reply_spam`."""
288
+ return reply_spam()
289
+
290
+ def reply_drop(self):
291
+ """Control-mode reply dropping the message. See module-level
292
+ :func:`reply_drop`."""
293
+ return reply_drop()
294
+
295
+ def reply_block_sender(self):
296
+ """Control-mode reply blocking the sender. See module-level
297
+ :func:`reply_block_sender`."""
298
+ return reply_block_sender()
299
+
254
300
  def encrypt(self, plaintext, public_key):
255
301
  """Encrypt to a MailKite at-rest envelope. See module-level
256
302
  :func:`encrypt`."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mailkite-dev
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: Official MailKite SDK for Python — send and manage email over your own authenticated domain.
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://mailkite.dev/docs/libraries
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
  # old account. Installs as `pip install mailkite-dev`; still imports as `import mailkite`
8
8
  # (the package dir below is unchanged). Rename back to `mailkite` once reclaimed.
9
9
  name = "mailkite-dev"
10
- version = "0.4.0"
10
+ version = "0.5.0"
11
11
  description = "Official MailKite SDK for Python — send and manage email over your own authenticated domain."
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.7"
File without changes
File without changes