From 38dd0d847b883e0eb6c73bce5a344879c5b4786d Mon Sep 17 00:00:00 2001 From: nikkel Date: Fri, 20 Mar 2020 03:31:07 +0700 Subject: [PATCH] Update 'README.md' --- README.md | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7ab8661..c75acbb 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,33 @@ -# postman-rails +# Postman for Rails -A Rails library for the Postman email platform \ No newline at end of file +Postman for Rails allows you to integrate Postman directly into Action Mailer in a Rails application. There's no need to change any of your existing mailers, you just need to update your environment config. + +## Installation + +Add the `postman-rails` gem to your Gemfile and run `bundle install` to install it. + +```ruby +gem 'postman-rails', '~> 1.0' +``` + +## Configuration + +Open up your `config/environment/production.rb` or `config/environment/development.rb` and change the delivery method to `postman`. + +```ruby +config.action_mailer.delivery_method = :postman +``` + +You'll also need to provide your server key. If you don't have a server key, login to your web interface and generate a credential for the server you wish to send messages through. + +You also need to set the `POSTMAN_KEY` environment variable to include key and `POSTMAN_HOST` to include the hostname of your Postman service. + +Alternatively, you can configure it as shown below in your environment configuration file along with the `delivery_method`. + +```ruby +config.action_mailer.postman_settings = {:host => "postman.prmail.vn", :server_key => "xxxxx"} +``` + +That's it! Send an email to test everything is working as you'd expect. Remember, if you have `raise_delivery_errors` set to false you might not see any errors. Use `deliver!` when running your tests so any exceptions are raised. + +Don't forget, you need to make sure that you're sending mail from domains that are added & verified to your Postman domain.