This library allows you to quickly and easily use the SendGrid Web API via Ruby.
BREAKING CHANGE as of 2016.06.14
Version 2.0.0 is a breaking change for the entire library.
Version 2.0.0 brings you full support for all Web API v3 endpoints. We have the following resources to get you started quickly:
Thank you for your continued support!
All updates to this library is documented in our CHANGELOG.
First, get your free SendGrid account here.
Next, update your environment with your SENDGRID_API_KEY.
echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
echo "sendgrid.env" >> .gitignore
source ./sendgrid.envAdd this line to your application's Gemfile:
gem 'sendgrid-ruby'And then execute:
bundleOr install it yourself using:
gem install sendgrid-ruby- The SendGrid Service, starting at the free level
- Ruby-HTTP-Client
require 'sendgrid-ruby'
include SendGrid
from = Email.new(email: '[email protected]')
subject = 'Hello World from the SendGrid Ruby Library'
to = Email.new(email: '[email protected]')
content = Content.new(type: 'text/plain', value: 'some text here')
mail = Mail.new(from, subject, to, content)
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
response = sg.client.mail._('send').post(request_body: mail.to_json)
puts response.status_code
puts response.body
puts response.headersrequire 'sendgrid-ruby'
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
response = sg.client.api_keys.get()
puts response.status_code
puts response.body
puts response.headersIf you are interested in the future direction of this project, please take a look at our milestones. We would love to hear your feedback.
We encourage contribution to our libraries, please see our CONTRIBUTING guide for details.
sendgrid-ruby is guided and supported by the SendGrid Developer Experience Team.
sendgrid-ruby is maintained and funded by SendGrid, Inc. The names and logos for sendgrid-ruby are trademarks of SendGrid, Inc.
![SendGrid Logo] (https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png)