Skip to content

Commit 24a0500

Browse files
authored
Updated Readme
1 parent 5da831b commit 24a0500

File tree

1 file changed

+57
-5
lines changed

1 file changed

+57
-5
lines changed

README.md

Lines changed: 57 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
# SendableRails
2-
Short description and motivation.
1+
# Sendable Rails ActionMailer Client
32

4-
## Usage
5-
How to use my plugin.
3+
[Sendable](https://sendable.io) is a service that makes it simpler to design, manage and optimize your Transactional Emails. Sendable has created a Ruby gem `sendable` that communicates with our REST API for sending your transactional emails.
4+
5+
Ruby on Rails developers use the ActionMailer interface for sending emails. This gem, `sendable_rails` implements a small layer over the `sendable` gem that provides an API similar to ActionMailer.
66

77
## Installation
8+
89
Add this line to your application's Gemfile:
910

1011
```ruby
@@ -20,9 +21,60 @@ Or install it yourself as:
2021
```bash
2122
$ gem install sendable_rails
2223
```
24+
## Setup
25+
26+
### Environment Variables
27+
28+
Add the following environment variables to your application. You can get these values from the settings page of your Sendable dashboard.
29+
30+
`SENDABLE_PROJECT_ID`=`YOUR PROJECT ID`
31+
32+
`SENDABLE_API_KEY`=`YOUR API KEY`
33+
34+
## Usage
35+
36+
The only changes required in your existing `mail` method are:
37+
38+
- Replace `mail` with `sendable_mail`
39+
- Pass a `template_id` that you can get from your Sendable dashboard
40+
- Instance variables will be available in your templates as `mustache` attributes
41+
42+
Everything else will work as expected. Here is a before and after comparison:
43+
44+
### Before (Without Sendable)
45+
46+
```ruby
47+
class UserMailer < ActionMailer::Base
48+
default from: 'no-reply@example.com'
49+
50+
def welcome(user)
51+
@user = user
52+
mail( to: @user.email, subject: "Welcome to My Awesome Site!" )
53+
end
54+
end
55+
```
56+
57+
58+
### After (Using Sendable)
59+
60+
```ruby
61+
class UserMailer < ActionMailer::Base
62+
default from: 'no-reply@example.com'
63+
64+
def welcome(user)
65+
@user = user
66+
sendable_mail to: @user.email, template_id: 1
67+
end
68+
end
69+
```
2370

2471
## Contributing
25-
Contribution directions go here.
72+
73+
1. Fork it
74+
2. Create your feature branch (`git checkout -b my-new-feature`)
75+
3. Commit your changes (`git commit -am 'Add some feature'`)
76+
4. Push to the branch (`git push origin my-new-feature`)
77+
5. Create new Pull Request
2678

2779
## License
2880
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

0 commit comments

Comments
 (0)