mailkite 0.4.0 → 0.5.0
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.
- checksums.yaml +4 -4
- data/lib/mailkite.rb +39 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 16ccb6cd1fe7bcc80237e945bd42ea0f5f0f69d6fc618b955d8b0e93f70c04ef
|
|
4
|
+
data.tar.gz: 198dd419d07e5dda9fb2023ec653b600098f63f6837f11344db3e156d28c37e3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d61fd1fe911b68d90fb8359eb62fca139a8858d8dd3752d4930420e6ea2fdb6ed59c9264936a3582359ae407d5320946621c7ddcca151e691aeb24a6bf8977a5
|
|
7
|
+
data.tar.gz: 88ff488ba25e4ffccf1fdc4c26b5bcaf38b2a7bf7fb3d795a0f8165c08f53e6166bcb01420ec826c370895b163b83cd427ae7e984c1b97f4953eece037499d69
|
data/lib/mailkite.rb
CHANGED
|
@@ -15,7 +15,7 @@ require "base64"
|
|
|
15
15
|
require "cgi"
|
|
16
16
|
|
|
17
17
|
module Mailkite
|
|
18
|
-
VERSION = "0.
|
|
18
|
+
VERSION = "0.5.0"
|
|
19
19
|
DEFAULT_BASE_URL = "https://api.mailkite.dev"
|
|
20
20
|
# Reject webhook events older than this (ms) to block replays. Pass 0 to disable.
|
|
21
21
|
DEFAULT_TOLERANCE_MS = 5 * 60 * 1000
|
|
@@ -61,6 +61,24 @@ module Mailkite
|
|
|
61
61
|
'{"status":"ok"}'
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
+
# Control-mode reply telling MailKite to mark the message as spam.
|
|
65
|
+
# Returns the exact string `{"status":"spam"}`.
|
|
66
|
+
def self.reply_spam
|
|
67
|
+
'{"status":"spam"}'
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Control-mode reply telling MailKite to drop (discard) the message.
|
|
71
|
+
# Returns the exact string `{"status":"drop"}`.
|
|
72
|
+
def self.reply_drop
|
|
73
|
+
'{"status":"drop"}'
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Control-mode reply telling MailKite to block the sender.
|
|
77
|
+
# Returns the exact string `{"status":"ok","actions":[{"type":"block-sender"}]}`.
|
|
78
|
+
def self.reply_block_sender
|
|
79
|
+
'{"status":"ok","actions":[{"type":"block-sender"}]}'
|
|
80
|
+
end
|
|
81
|
+
|
|
64
82
|
# Encrypt a UTF-8 string to a customer RSA public key (SPKI/PEM), producing the
|
|
65
83
|
# MailKite at-rest envelope as a compact JSON string. Hybrid scheme: a fresh
|
|
66
84
|
# AES-256-GCM content key encrypts the data, then the raw key is wrapped with
|
|
@@ -166,6 +184,14 @@ module Mailkite
|
|
|
166
184
|
request("POST", "/v1/send", message)
|
|
167
185
|
end
|
|
168
186
|
|
|
187
|
+
# Upload a file (base64 `content`) and get back a secure, time-limited URL to
|
|
188
|
+
# reference as a send() attachment ({ filename, url }) or link inline —
|
|
189
|
+
# instead of base64-inlining large files on every send. `file` keys:
|
|
190
|
+
# filename, content (base64), plus optional contentType and retentionDays.
|
|
191
|
+
def uploadAttachment(file)
|
|
192
|
+
request("POST", "/v1/attachments", file)
|
|
193
|
+
end
|
|
194
|
+
|
|
169
195
|
# Run an inbound message through an AI agent. message keys: text (required),
|
|
170
196
|
# plus optional subject/from/html/routeId/address/model.
|
|
171
197
|
def agent(message)
|
|
@@ -270,6 +296,18 @@ module Mailkite
|
|
|
270
296
|
Mailkite.reply_ok
|
|
271
297
|
end
|
|
272
298
|
|
|
299
|
+
def reply_spam
|
|
300
|
+
Mailkite.reply_spam
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
def reply_drop
|
|
304
|
+
Mailkite.reply_drop
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
def reply_block_sender
|
|
308
|
+
Mailkite.reply_block_sender
|
|
309
|
+
end
|
|
310
|
+
|
|
273
311
|
def encrypt(plaintext, public_key)
|
|
274
312
|
Mailkite.encrypt(plaintext, public_key)
|
|
275
313
|
end
|