You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+57-5Lines changed: 57 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,11 @@
1
-
# SendableRails
2
-
Short description and motivation.
1
+
# Sendable Rails ActionMailer Client
3
2
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.
6
6
7
7
## Installation
8
+
8
9
Add this line to your application's Gemfile:
9
10
10
11
```ruby
@@ -20,9 +21,60 @@ Or install it yourself as:
20
21
```bash
21
22
$ gem install sendable_rails
22
23
```
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
+
classUserMailer < ActionMailer::Base
48
+
default from:'no-reply@example.com'
49
+
50
+
defwelcome(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
+
classUserMailer < ActionMailer::Base
62
+
default from:'no-reply@example.com'
63
+
64
+
defwelcome(user)
65
+
@user= user
66
+
sendable_mail to:@user.email, template_id:1
67
+
end
68
+
end
69
+
```
23
70
24
71
## 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
26
78
27
79
## License
28
80
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
0 commit comments