SMTP
Rails SMTP
Configure Action Mailer to deliver through eusend over SMTP — mailers, Devise emails, and any deliver_now/deliver_later, DKIM-signed and tracked.
Action Mailer uses SMTP for delivery, so pointing Ruby on Rails at eusend is a one-block configuration change. Every mailer, plus Devise confirmation and password-reset emails, then routes through eusend, DKIM-signed and tracked.
config/environments/production.rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.eusend.dev',
port: 465,
user_name: 'eusend', # the literal string "eusend"
password: ENV['EUSEND_API_KEY'], # eu_live_…
authentication: :plain,
tls: true, # implicit TLS on 465
enable_starttls_auto: false
}
# Must be an address on a domain verified in eusend
config.action_mailer.default_options = { from: 'Acme <[email protected]>' }⚠
Use tls: true (implicit TLS on port 465), not enable_starttls_auto. On some
Ruby/net-smtp versions the option is ssl: true — both select implicit TLS.
Send an email
class OrderMailer < ApplicationMailer
def shipped(order)
mail(to: order.email, subject: 'Your order has shipped')
end
end
OrderMailer.shipped(order).deliver_now # or deliver_laterTest the connection from the Rails console:
ActionMailer::Base.mail(
from: '[email protected]',
to: '[email protected]',
subject: 'SMTP test',
body: 'Hello from eusend.'
).deliver_nowConnection reference
| Setting | Value |
|---|---|
address | smtp.eusend.dev |
port | 465 (or 2465) |
tls | true |
user_name | eusend |
password | your eusend API key (eu_live_…) |
from | an address on a verified domain |
Use an eu_test_ key in development — sends are tracked but not delivered. See
the SMTP overview for limits and status codes.