Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.paubox.com/llms.txt

Use this file to discover all available pages before exploring further.

1

Add the gem

Add paubox_rails to your Gemfile:
gem 'paubox_rails'
Then install:
bundle install
2

Configure credentials

Create config/initializers/paubox.rb:
Paubox.configure do |config|
  config.api_key  = ENV['PAUBOX_API_KEY']
  config.api_user = ENV['PAUBOX_API_USER']
end
To obtain credentials, see Authentication.
3

Set the delivery method

In config/application.rb (or an environment-specific file):
config.action_mailer.delivery_method = :paubox
4

Create a mailer and send

Generate a mailer if you don’t have one:
rails generate mailer UserMailer
Define an action in app/mailers/user_mailer.rb:
class UserMailer < ApplicationMailer
  def welcome_email
    @user = params[:user]
    mail(
      to:      @user.email,
      from:    "noreply@yourdomain.com",
      subject: "Welcome to the portal"
    )
  end
end
Add a template at app/views/user_mailer/welcome_email.html.erb:
<p>Hello <%= @user.name %>,</p>
<p>Your account is ready. Log in at any time.</p>
Deliver it:
UserMailer.with(user: current_user).welcome_email.deliver_now
The email is sent encrypted via Paubox.

Next steps