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.

How it works

paubox_rails registers :paubox as an ActionMailer delivery method. Your mailer classes are standard Rails mailers — the gem intercepts delivery and routes each message through the Paubox Email API, ensuring every email is encrypted and HIPAA-compliant.

Set the delivery method

Globally (all environments):
# config/application.rb
config.action_mailer.delivery_method = :paubox
Per environment (recommended for production only):
# config/environments/production.rb
config.action_mailer.delivery_method = :paubox
Leave development and test environments using :letter_opener, :test, or another local delivery method.

Create a mailer

Mailers work exactly as documented in the Rails ActionMailer guide:
class PatientMailer < ApplicationMailer
  def appointment_reminder
    @patient     = params[:patient]
    @appointment = params[:appointment]

    mail(
      to:      @patient.email,
      from:    "appointments@yourclinic.com",
      subject: "Appointment reminder"
    )
  end
end
Templates live in app/views/patient_mailer/ as usual (appointment_reminder.html.erb, appointment_reminder.text.erb).

Deliver email

# Synchronous delivery
PatientMailer.with(patient: patient, appointment: appt).appointment_reminder.deliver_now

# Asynchronous delivery (via Active Job)
PatientMailer.with(patient: patient, appointment: appt).appointment_reminder.deliver_later

Per-message options

Pass delivery_method_options in the mail() call to override delivery behavior for a specific message:
mail(
  to:      @patient.email,
  subject: "Lab results",
  delivery_method_options: { allow_non_tls: true }
)

Attachments

Attach files using standard ActionMailer attachment helpers:
def report_email
  attachments["results.pdf"] = File.read(Rails.root.join("tmp/results.pdf"))

  mail(
    to:      params[:patient].email,
    subject: "Your lab results"
  )
end

Tracking IDs

The ActionMailer delivery flow does not surface per-send tracking IDs. If you need to record and look up a tracking ID for a specific send, use the Paubox Email API directly via a REST client alongside this gem.