Send email from Rails over SMTP

Set Action Mailer's SMTP settings to route your Rails app's mail through Unitpost. Same job as Nodemailer — different stack.

What are the SMTP settings?

Hostsmtp.unitpost.com
Usernameunitpost(always this literal value)
PasswordYour Unitpost API key(must carry emails:send)
Port (STARTTLS)587(or 2587 if blocked)
Port (implicit TLS)465(or 2465 if blocked)
From addressAny address on a verified domain

How do I set it up?

  1. Configure Action Mailer

    In your environment config (e.g. config/environments/production.rb), set the delivery method and SMTP settings.

    Ruby
    config.action_mailer.delivery_method = :smtp
    config.action_mailer.smtp_settings = {
      address:              "smtp.unitpost.com",
      port:                 587,
      user_name:            "unitpost",
      password:             ENV["UNITPOST_API_KEY"],
      authentication:       :plain,
      enable_starttls_auto: true,
    }
  2. Set your sender

    Use a from address on a verified domain in your mailer.

    Ruby
    class UserMailer < ApplicationMailer
      default from: "you@yourdomain.com"
    
      def welcome_email
        mail(to: "customer@example.com", subject: "Welcome!")
      end
    end
  3. Deliver and verify

    Trigger the mailer (UserMailer.welcome_email.deliver_now) and confirm the send in your Unitpost Activity view.