Setting Up

Ruby on Rails (Action Mailer)

Point a Rails application's Action Mailer SMTP settings at the service.

Point Action Mailer's SMTP settings at the gateway's inbound server instead of your provider's own server — nothing else about how your mailers are written needs to change.

# config/environments/production.rb (or an initializer, if you send from other
# environments too)
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  address:        "smtp.adlerwacht.com", # see /introduction/smtp-relay
  port:           587,            # or 465
  domain:         "yourcompany.com",
  user_name:      "you@yourcompany.com",
  password:       ENV.fetch("SMTP_PASSWORD"),
  authentication: :plain,
  enable_starttls_auto: true      # set to false and use port 465 for implicit TLS instead
}

Load the password from ENV or Rails credentials rather than hardcoding it.

If your application sends transactional and marketing mail through different accounts or a dedicated mailer class with its own delivery_method override, only the mailer(s) you want protected need to point at the gateway — this doesn't have to be an app-wide change.