This gem extends the Paubox Ruby Gem for use with ActionMailer in Ruby on Rails.
The Paubox Email API allows your application to send secure, HIPAA compliant email via Paubox and track deliveries and opens.
This gem has been tested and confirmed working with Rails 4-6
Add this line to your application's Gemfile:
gem 'paubox_rails'
And then execute:
$ bundle
Or install it yourself as:
$ gem install paubox_rails
You will need to have a Paubox account. You can sign up here.
Once you have an account, follow the instructions on the Rest API dashboard to verify domain ownership and generate API credentials.
Create a new file at config/initializers/paubox.rb and add the following.
Paubox.configure do |config|
config.api_key = ENV['PAUBOX_API_KEY']
config.api_user = ENV['PAUBOX_API_USER']
end
Note: Keep your unencrypted API credentials out of version control. Set as environment variables in a file that's not checked into version control, such as config/application.yml or config/secrets.yml. Better yet, use Rails Encrypted Secrets.
Add the following to the configuration block in config/application.rb or the desired environment config in config/environments (e.g. config/environments/production.rb for production.)
config.action_mailer.delivery_method = :paubox
You can use Action Mailer as you normally would in a Rails app.
See the Paubox Ruby Gem for more advanced usage examples.
Set allow_non_tls
to true in the delivery_method_options
hash argument and pass this into the mailer action.
For example:
class UserMailer < ApplicationMailer
def welcome_email
@user = params[:user]
@url = user_url(@user)
delivery_options = { allow_non_tls: true }
mail(to: @user.email,
subject: "Welcome!",
delivery_method_options: delivery_options)
end
end
Bug reports and pull requests are welcome on GitHub at https://github.com/paubox/paubox-rails.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2022, Paubox, Inc.