[Awesome Ruby Gem] Use postmark-rails gem to send your emails and track opens and tag your deliveries
postmark-rails
Postmark: Application Email Service with Exceptional Delivery - https://postmarkapp.com/ allows you to send your emails with high delivery rates. It also includes detailed statistics. In addition, Postmark can parse incoming emails which are forwarded back to your application.
The Postmark Rails Gem is a drop-in plug-in for ActionMailer to send emails via [Postmark - https://postmarkapp.com/)(https://postmarkapp.com/). The gem has been created for fast implementation and fully supports all of Postmark’s features - https://postmarkapp.com/why.
Prerequites
You will need a Postmark account - https://account.postmarkapp.com/login, server and sender signature (or verified domain) set up to use it. For details about setup, check out wiki pages - https://github.com/wildbit/postmark-rails/wiki/Getting-Started.
Installation
You can install it as a gem:
1 | gem install postmark-rails |
or add it into a Gemfile (Bundler):
1 | # Gemfile |
Then, run bundle install
.
1 | bundle install |
Configuration
Rails 6
Save your Postmark Server API Token to config/credentials.yml.enc
:
run rails secret
, then run rails credentials:edit
and add:
1 | postmark_api_token: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" |
Set Postmark as your preferred mail delivery method via config/application.rb
:
1 | config.action_mailer.delivery_method = :postmark |
Usage
After setting it all up, you can send emails like this:
1 | class TestMailer < ActionMailer::Base |
See Home · wildbit/postmark-gem Wiki - https://github.com/wildbit/postmark-gem/wiki to learn more usages.
References
[2] postmark-rails | RubyGems.org | your community gem host - https://rubygems.org/gems/postmark-rails
[5] Home · wildbit/postmark-gem Wiki - https://github.com/wildbit/postmark-gem/wiki
[6] Postmark: Application Email Service with Exceptional Delivery - https://postmarkapp.com/