Ruby library for sending email via the Sendable REST API.
Add this line to your application's Gemfile:
gem'sendable'And then execute:
$ bundle
Or install it yourself as:
$ gem install sendable
Sendable.configdo |config|
config.api_key='YOUR API KEY'endReturns the rendered HTML for your template.
- template - string - Your email template's id
- params - hash - Object containing the following keys
- data - hash - Any email template data that will replace the email template variables
result=Sendable.client.render(1,{data: {first_name: 'John',age: 28}}){success: true,email: {html: "<html><head></head><body><h1>Sample HTML</h1></body></html>",plain: "Sample Plain Text",subject: "Sample Subject",preheader: "Sample Preheader"}}Sends the email using your configured SMTP mailer in Sendable.
- template - string - Your email template's id
- params - hash - Object containing the following keys
- to - string - This is the recipient's email address
- from - string - This is the sender's email address
- data - hash - Any email template data that will replace the email template variables
result=Sendable.client.email(1,{to: 'john@doe.com',from: 'me@awesomesite.com',data: {first_name: 'John',age: 28}}){success: true,email: {html: "<html><head></head><body><h1>Sample HTML</h1></body></html>",plain: "Sample Plain Text",subject: "Sample Subject",preheader: "Sample Preheader"},delivery: {}}The delivery key will include the response from your ESP.
The gem is available as open source under the terms of the MIT License.