---
title: "Ruby on Rails"
description: "Configure Action Mailer to deliver through Unitpost SMTP."
url: https://www.unitpost.com/guides/smtp/rails
section: SMTP
updated: 2026-07-24
---
# Ruby on Rails

## Connection settings

- **Host**: smtp.unitpost.com
- **Username**: unitpost (always this literal value)
- **Password**: Your Unitpost API key (must carry emails:send)
- **Port (STARTTLS)**: 587 (or 2587 if blocked)
- **Port (implicit TLS)**: 465 (or 2465 if blocked)
- **From address**: Any address on a verified domain

## Ruby on Rails

> Configure Action Mailer to deliver through Unitpost SMTP.

Set Action Mailer's SMTP settings to route your Rails app's mail through Unitpost.

### 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.

## Related

- [Laravel](https://www.unitpost.com/guides/smtp/laravel): Point Laravel's mail config at Unitpost with a few env vars.
- [Django](https://www.unitpost.com/guides/smtp/django): Use Django's SMTP email backend with Unitpost.
- [PHPMailer](https://www.unitpost.com/guides/smtp/php): Send from any PHP app using the PHPMailer library.
