README.md in mailtrap-2.1.0 vs README.md in mailtrap-2.1.1

- old
+ new

@@ -1,7 +1,12 @@ [![test](https://github.com/railsware/mailtrap-ruby/actions/workflows/main.yml/badge.svg)](https://github.com/railsware/mailtrap-ruby/actions/workflows/main.yml) +[![docs](https://shields.io/badge/docs-rubydoc.info-blue)](https://rubydoc.info/gems/mailtrap) +[![gem](https://shields.io/gem/v/mailtrap)](https://rubygems.org/gems/mailtrap) +[![downloads](https://shields.io/gem/dt/mailtrap)](https://rubygems.org/gems/mailtrap) + + # Official Mailtrap Ruby client This Ruby gem offers integration with the [official API](https://api-docs.mailtrap.io/) for [Mailtrap](https://mailtrap.io). Quickly add email sending functionality to your Ruby application with Mailtrap. @@ -24,13 +29,23 @@ $ gem install mailtrap ## Usage -### Minimal +### Ruby on Rails ```ruby +# place this code in config/environments/production.rb: +config.action_mailer.delivery_method = :mailtrap + +# then set the MAILTRAP_API_KEY environment variable +# using your hosting solution. +``` + +### Pure Ruby + +```ruby require 'mailtrap' # create mail object mail = Mailtrap::Mail::Base.new( from: { email: 'mailtrap@example.com', name: 'Mailtrap Test' }, @@ -44,27 +59,27 @@ # create client and send client = Mailtrap::Client.new(api_key: 'your-api-key') client.send(mail) ``` -Refer to the [`examples`](examples) folder for other examples. +Refer to the [`examples`](examples) folder for more examples. - [Full](examples/full.rb) - [Email template](examples/email_template.rb) - [ActionMailer](examples/action_mailer.rb) ### Content-Transfer-Encoding `mailtrap` gem uses Mailtrap API to send emails. Mailtrap API does not try to -replicate SMTP. That is why you should expect some limitations when it comes to +replicate SMTP. That is why you should expect some limitations when it comes to sending. For example, `/api/send` endpoint ignores `Content-Transfer-Encoding` (see `headers` in the [API documentation](https://railsware.stoplight.io/docs/mailtrap-api-docs/67f1d70aeb62c-send-email)). -Meaning your recipients will receive emails only in the default encoding which +Meaning your recipients will receive emails only in the default encoding which is `quoted-printable`, if you send with Mailtrap API. -For those who does need to use `7bit` or any other encoding, SMTP provides -better flexibility in that regard. Go to your _Mailtrap account_ → _Email Sending_ -→ _Sending Domains_ → _Your domain_ → _SMTP/API Settings_ to find the SMTP +For those who does need to use `7bit` or any other encoding, SMTP provides +better flexibility in that regard. Go to your _Mailtrap account_ → _Email Sending_ +→ _Sending Domains_ → _Your domain_ → _SMTP/API Settings_ to find the SMTP configuration example. ## Migration guide v1 → v2 Change `Mailtrap::Sending::Client` to `Mailtrap::Client`.