Module: Mailblastr

Defined in:
lib/mailblastr.rb,
lib/mailblastr/logs.rb,
lib/mailblastr/error.rb,
lib/mailblastr/polls.rb,
lib/mailblastr/client.rb,
lib/mailblastr/emails.rb,
lib/mailblastr/events.rb,
lib/mailblastr/topics.rb,
lib/mailblastr/domains.rb,
lib/mailblastr/version.rb,
lib/mailblastr/api_keys.rb,
lib/mailblastr/contacts.rb,
lib/mailblastr/segments.rb,
lib/mailblastr/webhooks.rb,
lib/mailblastr/audiences.rb,
lib/mailblastr/campaigns.rb,
lib/mailblastr/templates.rb,
lib/mailblastr/automations.rb,
lib/mailblastr/contact_properties.rb

Overview

The MailBlastr API client.

Mailblastr.api_key = "mb_xxxxxxxxx"

sent = Mailblastr::Emails.send({
from: "Acme <hello@yourdomain.com>",
to: ["delivered@mailblastr.dev"],
subject: "Hello from MailBlastr",
html: "<p>Your first email</p>"
})
sent["id"] # => "..."

delivered@mailblastr.dev is the mailbox simulator: the send is accepted and produces a real email object without reaching a provider. Swap in a real recipient when you go live — an address on a reserved documentation domain (example.com, .test, .invalid) is refused with 422 reserved_recipient.

Defined Under Namespace

Modules: ApiKeys, Audiences, Automations, Batch, Campaigns, Client, ContactProperties, Contacts, Domains, Emails, Events, Logs, Polls, Segments, Templates, Topics, Webhooks Classes: Error

Constant Summary collapse

DEFAULT_BASE_URL =
"https://www.mailblastr.com/api"
DEFAULT_TIMEOUT =

Per-request network timeout, in seconds, applied to both the connect (open) and read phases. 0 or nil means "no timeout".

30
DEFAULT_MAX_RETRIES =

How many times a retryable response (HTTP 429/503) is retried before giving up. 0 disables retries (a single attempt).

2
VERSION =
"5.0.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_keyObject

Your API key, e.g. "mb_xxxxxxxxx". Required before any call.



51
52
53
# File 'lib/mailblastr.rb', line 51

def api_key
  @api_key
end

.base_urlObject



62
63
64
# File 'lib/mailblastr.rb', line 62

def base_url
  @base_url || DEFAULT_BASE_URL
end

.max_retriesObject



70
71
72
# File 'lib/mailblastr.rb', line 70

def max_retries
  @max_retries.nil? ? DEFAULT_MAX_RETRIES : @max_retries
end

.timeoutObject



66
67
68
# File 'lib/mailblastr.rb', line 66

def timeout
  @timeout.nil? ? DEFAULT_TIMEOUT : @timeout
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Mailblastr.configure do |config| config.api_key = ENV end

Yields:

  • (_self)

Yield Parameters:

  • _self (Mailblastr)

    the object that the method was called on



77
78
79
# File 'lib/mailblastr.rb', line 77

def configure
  yield self
end