README.md in simple_postmark-0.4.3 vs README.md in simple_postmark-0.4.4

- old
+ new

@@ -1,11 +1,12 @@ -# simple_postmark [![Build Status](https://secure.travis-ci.org/haihappen/simple_postmark.png?branch=master)](http://travis-ci.org/haihappen/simple_postmark) +# simple_postmark SimplePostmark makes it easy to send mails via [Postmark](http://postmarkapp.com)™ using Rails 3's ActionMailer. SimplePostmark is inspired by [postmark-gem](https://github.com/wildbit/postmark-gem), but unfortunately postmark-gem forced to me to use non-standard Rails calls like `postmark_attachments`. SimplePostmark uses the standard Rails 3's ActionMailer syntax to send your emails via Postmark. -Tested against Ruby versions `1.9.2`, `1.9.3`, `ruby-head` and Rails versions `3.0.x`, `3.1.x`, `3.2.x`, `master` (upcoming Rails `4.0.0`). +Tested against Ruby versions `1.9.2`, `1.9.3` and Rails versions `3.0.x`, `3.1.x`, `3.2.x`. +`ruby-head` (a.k.a. Ruby `2.0`) and Rails `master` (upcoming Rails `4.0`) should work too btw. If you are still using Ruby `1.8.7` or `Ruby Enterprise Edition` with Rails 3, you can use the backported version of this gem called [simple_postmark18](https://github.com/haihappen/simple_postmark/tree/ruby18). ## Installation @@ -42,18 +43,43 @@ ```ruby class NotificationMailer < ActionMailer::Base def notification attachments['thebrocode.pdf'] = File.read('thebrocode.pdf') - + mail(to: 'ted@himym.tld', from: 'barney@himym.tld', subject: "I'm your bro!", tag: 'with-attachment') do # ... end end end ``` +## Advanced Configuration + +* `api_key`: Your Postmark API key. Go to [your Rack](https://postmarkapp.com/servers), +selected the one you want to use and then go to the **Credentials** tab to find your API key. + +* `return_response`: In order to receive the response from the Postmark API +– for example, if you want to store ErrorCode or MessageID - +set it to `true`. ([Mail](https://github.com/mikel/mail) which is the base of simple_postmark +expects this option.) + +Example how the ErrorCode, MessageID and other values can be received from Postmark: + +```ruby +# config/environments/production.rb +config.action_mailer.simple_postmark_settings = { api_key: '********-****-****-****-************', return_response: true } + +# your_mailer.rb +response = YourMailer.email.deliver!.parsed_response + +response['MessageID'] + # => "b7bc2f4a-e38e-4336-af7d-e6c392c2f817" +response['ErrorCode'] + # => 0 +``` + ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Added some feature'`) @@ -81,6 +107,6 @@ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.