https://github.com/sendgrid/sendgrid-ruby
The Official Twilio SendGrid Led, Community Driven Ruby API Library
https://github.com/sendgrid/sendgrid-ruby
Keywords
email ruby sendgrid transactional-emails
Keywords from Contributors
twilio twilio-api twiml activerecord rubygems activejob mvc crash-reporting devise omniauth
Last synced: about 8 hours ago
JSON representation
Repository metadata
The Official Twilio SendGrid Led, Community Driven Ruby API Library
- Host: GitHub
- URL: https://github.com/sendgrid/sendgrid-ruby
- Owner: sendgrid
- License: mit
- Created: 2014-06-10T13:56:38.000Z (over 11 years ago)
- Default Branch: main
- Last Pushed: 2024-08-02T04:04:47.000Z (over 1 year ago)
- Last Synced: 2026-02-13T12:17:30.977Z (18 days ago)
- Topics: email, ruby, sendgrid, transactional-emails
- Language: Ruby
- Homepage: https://sendgrid.com
- Size: 1010 KB
- Stars: 636
- Watchers: 199
- Forks: 324
- Open Issues: 30
- Releases: 63
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
README.md

This library allows you to quickly and easily use the Twilio SendGrid Web API v3 via Ruby.
Version 3.X.X+ of this library provides full support for all Twilio SendGrid Web API v3 endpoints, including the new v3 /mail/send.
This library represents the beginning of a new path for Twilio SendGrid. We want this library to be community driven and Twilio SendGrid led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create issues and pull requests or simply upvote or comment on existing issues or pull requests.
If you need help using SendGrid, please check the Twilio SendGrid Support Help Center.
Table of Contents
- Announcements
- Installation
- Quick Start
- Processing Inbound Email
- Usage
- Use Cases
- Announcements
- How to Contribute
- Troubleshooting
- About
- Support
- License
Installation
Prerequisites
- Ruby version >= 2.4 (except version 2.6.0)
- The Twilio SendGrid service, starting at the free level
Setup Environment Variables
Update the development environment with your SENDGRID_API_KEY, for example:
echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
echo "sendgrid.env" >> .gitignore
source ./sendgrid.env
Install Package
Add this line to your application's Gemfile:
gem 'sendgrid-ruby'
And then execute:
bundle
Or install it yourself using:
gem install sendgrid-ruby
Dependencies
Quick Start
Hello Email
The following is the minimum needed code to send an email with the /mail/send Helper (here is a full example):
With Mail Helper Class
require 'sendgrid-ruby'
include SendGrid
from = SendGrid::Email.new(email: 'test@example.com')
to = SendGrid::Email.new(email: 'test@example.com')
subject = 'Sending with Twilio SendGrid is Fun'
content = SendGrid::Content.new(type: 'text/plain', value: 'and easy to do anywhere, even with Ruby')
mail = SendGrid::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.parsed_body
puts response.headers
For more complex scenarios, please do not use the above constructor and instead build your own personalization object as demonstrated here.
Without Mail Helper Class
The following is the minimum needed code to send an email without the /mail/send Helper (here is a full example):
require 'sendgrid-ruby'
include SendGrid
data = JSON.parse('{
"personalizations": [
{
"to": [
{
"email": "test@example.com"
}
],
"subject": "Sending with Twilio SendGrid is Fun"
}
],
"from": {
"email": "test@example.com"
},
"content": [
{
"type": "text/plain",
"value": "and easy to do anywhere, even with Ruby"
}
]
}')
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
response = sg.client.mail._("send").post(request_body: data)
puts response.status_code
puts response.body
puts response.parsed_body
puts response.headers
General v3 Web API Usage (With Fluent Interface)
require 'sendgrid-ruby'
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
response = sg.client.suppression.bounces.get()
puts response.status_code
puts response.body
puts response.parsed_body
puts response.headers
General v3 Web API Usage (Without Fluent Interface)
require 'sendgrid-ruby'
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
response = sg.client._("suppression/bounces").get()
puts response.status_code
puts response.body
puts response.parsed_body
puts response.headers
Processing Inbound Email
Please see our helper for utilizing our Inbound Parse webhook.
Usage
- Twilio SendGrid Docs
- Library Usage Docs
- Example Code
- How-to: Migration from v2 to v3
- v3 Web API Mail Send Helper - build a request object payload for a v3 /mail/send API call.
- Settings Helper
Use Cases
Examples of common API use cases, such as how to send an email with a transactional template.
Announcements
All updates to this library are documented in our CHANGELOG and releases.
How to Contribute
We encourage contribution to our libraries (you might even score some nifty swag), please see our CONTRIBUTING guide for details.
Troubleshooting
Please see our troubleshooting guide for common library issues.
About
sendgrid-ruby is maintained and funded by Twilio SendGrid, Inc. The names and logos for sendgrid-ruby are trademarks of Twilio SendGrid, Inc.
If you need help using SendGrid, please check the Twilio SendGrid Support Help Center.
License
Owner metadata
- Name: Twilio SendGrid
- Login: sendgrid
- Email:
- Kind: organization
- Description: Official open source libraries - send emails and integrate with our APIs fast.
- Website: https://sendgrid.com
- Location: The Internet
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/181234?v=4
- Repositories: 127
- Last ynced at: 2024-04-08T15:40:00.703Z
- Profile URL: https://github.com/sendgrid
GitHub Events
Total
- Pull request event: 2
- Fork event: 8
- Issues event: 1
- Watch event: 12
- Issue comment event: 7
- Pull request review event: 1
- Pull request review comment event: 1
Last Year
- Pull request event: 1
- Fork event: 5
- Issues event: 1
- Watch event: 8
- Issue comment event: 7
- Pull request review event: 1
- Pull request review comment event: 1
Committers metadata
Last synced: 2 days ago
Total Commits: 552
Total Committers: 96
Avg Commits per committer: 5.75
Development Distribution Score (DDS): 0.71
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Elmer Thomas | e****r@t****m | 160 |
| Twilio | t****i@t****m | 53 |
| Eddie Zaneski | e****e@g****m | 41 |
| Sam Harrison | s****n@t****m | 40 |
| rbin | me@r****o | 29 |
| Twilio | t****b@t****m | 20 |
| Jake Yesbeck | j****e@a****m | 17 |
| awwa500@gmail.com | a****0@g****m | 17 |
| alanunruh | a****h@g****m | 13 |
| kernkw | k****n@g****m | 10 |
| Elise Shanholtz | e****z@t****m | 8 |
| GustavoCaso | g****o@g****m | 7 |
| Manjiri Tapaswi | m****w@n****u | 6 |
| Billy Watson | w****n@g****m | 5 |
| Shwetha Radhakrishna | s****e | 5 |
| Kyle Roberts | e****l@k****g | 4 |
| Ryunosuke Sato | t****s@g****m | 4 |
| thepriefy | p****m@h****m | 4 |
| chandler | c****r@c****m | 4 |
| af4ro | 1****l@g****m | 4 |
| Matt Bernier | m****r@s****m | 4 |
| tkbky | k****g@t****g | 3 |
| Cícero Pablo | c****s@g****m | 3 |
| Dylan | d****h@g****m | 3 |
| Mike de Bock | m****k@m****l | 3 |
| Sebastian Skałacki | s****e@g****m | 3 |
| rahul26goyal | g****l@g****m | 2 |
| pushkyn | a****n@g****m | 2 |
| colto | c****c@g****m | 2 |
| Tom Lehman | t****n@g****m | 2 |
| and 66 more... | ||
Committer domains:
- twilio.com: 5
- sendgrid.com: 2
- thinkingserious.com: 1
- rbin.co: 1
- apartmentlist.com: 1
- ncsu.edu: 1
- kylearoberts.org: 1
- chandlerweiner.com: 1
- tinkerbox.com.sg: 1
- masterwebber.nl: 1
- wetransfer.com: 1
- colgate.edu: 1
- traveltriangle.com: 1
- outten.net: 1
- anvyl.com: 1
- czlowieq.pl: 1
- bucyou.net: 1
- prosperworks.com: 1
- garethpaul.com: 1
- jaredsilver.name: 1
- jjb.cc: 1
- pace.edu: 1
Issue and Pull Request metadata
Last synced: 16 days ago
Total issues: 6
Total pull requests: 113
Average time to close issues: about 6 hours
Average time to close pull requests: 10 months
Total issue authors: 6
Total pull request authors: 71
Average comments per issue: 1.83
Average comments per pull request: 1.38
Merged pull request: 63
Bot issues: 0
Bot pull requests: 0
Past year issues: 2
Past year pull requests: 2
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 2
Past year pull request authors: 1
Past year average comments per issue: 0.0
Past year average comments per pull request: 0.0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- ManuelSaleta (1)
- gotchahn (1)
- fangbyte (1)
- utkarsh1996 (1)
- campgurus (1)
- reedperkins (1)
Top Pull Request Authors
- thinkingserious (12)
- childish-sambino (10)
- eshanholtz (4)
- kylearoberts (3)
- shwetha-manvinkurke (3)
- beebzz (3)
- fkmy (2)
- grin (2)
- andrii-baran-nfgp (2)
- douglaslise (2)
- RolandBurrows (2)
- kplimack (2)
- dhoeric (2)
- renshuki (2)
- dipil-saud (2)
Top Issue Labels
- type: question (1)
- status: waiting for feedback (1)
- type: bug (1)
Top Pull Request Labels
- status: code review request (65)
- difficulty: medium (17)
- difficulty: easy (14)
- status: duplicate (5)
- type: twilio enhancement (5)
- type: community enhancement (4)
- difficulty: hard (4)
- status: waiting for feedback (3)
- type: docs update (3)
- status: wontfix (2)
- status: ready for deploy (2)
- type: question (1)
- type: bug (1)
Package metadata
- Total packages: 3
-
Total downloads:
- rubygems: 108,698,550 total
- Total docker downloads: 908
- Total dependent packages: 23 (may contain duplicates)
- Total dependent repositories: 1,449 (may contain duplicates)
- Total versions: 174
- Total maintainers: 1
gem.coop: sendgrid-ruby
Official Twilio SendGrid Gem to Interact with Twilio SendGrids API in native Ruby
- Homepage: http://github.com/sendgrid/sendgrid-ruby
- Documentation: http://www.rubydoc.info/gems/sendgrid-ruby/
- Licenses: MIT
- Latest release: 6.7.0 (published over 2 years ago)
- Last Synced: 2026-03-02T17:33:51.010Z (1 day ago)
- Versions: 67
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 54,344,092 Total
- Docker Downloads: 454
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.165%
- Downloads: 0.496%
- Maintainers (1)
rubygems.org: sendgrid-ruby
Official Twilio SendGrid Gem to Interact with Twilio SendGrids API in native Ruby
- Homepage: http://github.com/sendgrid/sendgrid-ruby
- Documentation: http://www.rubydoc.info/gems/sendgrid-ruby/
- Licenses: MIT
- Latest release: 6.7.0 (published over 2 years ago)
- Last Synced: 2026-03-02T20:30:43.120Z (1 day ago)
- Versions: 67
- Dependent Packages: 23
- Dependent Repositories: 1,449
- Downloads: 54,354,458 Total
- Docker Downloads: 454
-
Rankings:
- Downloads: 0.555%
- Dependent repos count: 0.82%
- Dependent packages count: 1.079%
- Average: 1.456%
- Forks count: 1.478%
- Stargazers count: 2.284%
- Docker downloads count: 2.521%
- Maintainers (1)
proxy.golang.org: github.com/sendgrid/sendgrid-ruby
- Homepage:
- Documentation: https://pkg.go.dev/github.com/sendgrid/sendgrid-ruby#section-documentation
- Licenses: mit
- Latest release: v6.0.0+incompatible (published over 6 years ago)
- Last Synced: 2026-02-28T19:00:45.808Z (3 days ago)
- Versions: 40
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 5.442%
- Average: 5.624%
- Dependent repos count: 5.807%
Dependencies
- ruby_http_client >= 0
- faker >= 0 development
- minitest ~> 5.9 development
- pry >= 0 development
- rack >= 0 development
- rake ~> 13.0 development
- rspec >= 0 development
- simplecov ~> 0.18.5 development
- sinatra >= 1.4.7, < 3 development
- ruby_http_client ~> 3.4
- amannn/action-semantic-pull-request v4 composite
- actions/checkout v2 composite
- docker/login-action v1 composite
- rtCamp/action-slack-notify v2 composite
- ruby/setup-ruby v1 composite
- sendgrid/dx-automator/actions/datadog-release-metric main composite
- sendgrid/dx-automator/actions/release main composite
- $version latest build
Score: 29.569748870915916