Module: Mailblastr::Emails
- Defined in:
- lib/mailblastr/emails.rb
Overview
Send and inspect emails. Inbound mail lives under Mailblastr::Emails::Receiving.
Defined Under Namespace
Modules: Receiving
Class Method Summary collapse
-
.batch(payloads, options = {}) ⇒ Object
Send up to 100 emails in one request.
-
.cancel(email_id) ⇒ Object
Cancel a scheduled email.
-
.get(email_id) ⇒ Object
Retrieve a sent email and its events.
-
.get_attachment(email_id, attachment_id) ⇒ Object
Retrieve one attachment's metadata.
-
.list(params = {}) ⇒ Object
List sent emails (trimmed list items).
-
.list_attachments(email_id) ⇒ Object
List a sent email's attachments.
-
.send(params, options = {}) ⇒ Object
Send a single email.
-
.update(email_id, params) ⇒ Object
Reschedule a scheduled email.
Class Method Details
.batch(payloads, options = {}) ⇒ Object
Send up to 100 emails in one request. POST /emails/batch (alias of Batch.send).
15 16 17 |
# File 'lib/mailblastr/emails.rb', line 15 def batch(payloads, = {}) Client.request(:post, "/emails/batch", body: payloads, options: ) end |
.cancel(email_id) ⇒ Object
Cancel a scheduled email. POST /emails/:id/cancel
46 47 48 |
# File 'lib/mailblastr/emails.rb', line 46 def cancel(email_id) Client.request(:post, "/emails/#{Client.path_escape(email_id)}/cancel") end |
.get(email_id) ⇒ Object
Retrieve a sent email and its events. GET /emails/:id
25 26 27 |
# File 'lib/mailblastr/emails.rb', line 25 def get(email_id) Client.request(:get, "/emails/#{Client.path_escape(email_id)}") end |
.get_attachment(email_id, attachment_id) ⇒ Object
Retrieve one attachment's metadata. GET /emails/:id/attachments/:attachment_id
35 36 37 |
# File 'lib/mailblastr/emails.rb', line 35 def (email_id, ) Client.request(:get, "/emails/#{Client.path_escape(email_id)}/attachments/#{Client.path_escape()}") end |
.list(params = {}) ⇒ Object
List sent emails (trimmed list items). GET /emails
20 21 22 |
# File 'lib/mailblastr/emails.rb', line 20 def list(params = {}) Client.request(:get, "/emails", query: Client.pagination(params)) end |
.list_attachments(email_id) ⇒ Object
List a sent email's attachments. GET /emails/:id/attachments
30 31 32 |
# File 'lib/mailblastr/emails.rb', line 30 def (email_id) Client.request(:get, "/emails/#{Client.path_escape(email_id)}/attachments") end |
.send(params, options = {}) ⇒ Object
Send a single email. POST /emails Mailblastr::Emails.send({ from: "...", to: ["..."], subject: "...", html: "..." }) Pass { idempotency_key: "order-123" } as the second argument to retry safely.
10 11 12 |
# File 'lib/mailblastr/emails.rb', line 10 def send(params, = {}) Client.request(:post, "/emails", body: params, options: ) end |
.update(email_id, params) ⇒ Object
Reschedule a scheduled email. PATCH /emails/:id Mailblastr::Emails.update("email_id", { scheduled_at: "2026-08-01T09:00:00Z" })
41 42 43 |
# File 'lib/mailblastr/emails.rb', line 41 def update(email_id, params) Client.request(:patch, "/emails/#{Client.path_escape(email_id)}", body: params) end |