---
title: "Send email from Rails over SMTP"
description: "Action Mailer pointed at Unitpost."
url: https://www.unitpost.com/guides/smtp/rails
section: SMTP
updated: 2026-08-28
---
# Send email from Rails over SMTP

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

## Send email from Rails over SMTP

> Action Mailer pointed at Unitpost.

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

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

- [Send email from Laravel over SMTP](https://www.unitpost.com/guides/smtp/laravel): MAIL_HOST in .env pointed at Unitpost.
- [Send email from Django over SMTP](https://www.unitpost.com/guides/smtp/django): Django EMAIL_BACKEND pointed at Unitpost.
- [Send email with PHPMailer over SMTP](https://www.unitpost.com/guides/smtp/php): PHPMailer SMTP mode pointed at Unitpost.
