Integrations · Frameworks
ActionMailer through Notix, Devise and all.
Rails apps already send through ActionMailer, so the integration is a delivery setting: point smtp_settings at the relay and every mailer, including Devise's confirmation and reset emails, goes through Notix. There is no Ruby SDK; for an idempotent send, one Net::HTTP call to the JSON API does it.
The send
Send an email from Rails.
config/environments/production.rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.usenotix.dev",
port: 587,
user_name: "notix",
password: Rails.application.credentials.dig(:notix, :api_key),
authentication: "plain",
enable_starttls: true
}
config.action_mailer.default_options = { from: "receipts@acme.com" }
require "net/http"
require "json"
uri = URI("https://app.usenotix.dev/api/v1/emails")
request = Net::HTTP::Post.new(uri, {
"Authorization" => "Bearer #{Rails.application.credentials.dig(:notix, :api_key)}",
"Content-Type" => "application/json",
"Idempotency-Key" => "order-#{order.id}-receipt"
})
request.body = { from: "receipts@acme.com", to: order.email, subject: "Your receipt", html: "<p>Thanks.</p>" }.to_json
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
The from address must be on a domain you have verified in Notix. Step by step: the SMTP quickstart and the longer guide to sending email from Rails.
Credentials
The key in encrypted credentials.
Store the API key with bin/rails credentials:edit under notix: api_key, as both samples read it. It is the SMTP password and the API bearer token at once; there is no separate SMTP password.
FAQ
Questions, answered.
Does Devise send through Notix?
Yes, with no code changes. Devise uses ActionMailer, so once smtp_settings point at the relay its emails go through Notix. Set the from address to one on your verified domain.
Is there a Notix Ruby gem?
No. Notix publishes SDKs for TypeScript, Python and PHP. From Ruby, use the SMTP relay or the JSON API over HTTPS.
Why is my send refused with a from-address error?
The from address must be on a domain you have verified in Notix. Add the domain in the console, publish the DNS records it shows, and wait for verification; until then, sends from that domain are refused.
Send your first email in five minutes.
Verify a domain, copy an API key, make one call. The free plan does not ask for a card.