forked from sendgrid/sendgrid-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de393aa
commit 7afb94b
Showing
6 changed files
with
45 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
SENDGRID_USERNAME=your_sendgrid_username | ||
SENDGRID_PASSWORD=your_sendgrid_password | ||
SENDGRID_APIKEY=your_sendgrid_apikey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ | |
/test/tmp/ | ||
/test/version_tmp/ | ||
/tmp/ | ||
.env | ||
test.rb | ||
|
||
## Specific to RubyMotion: | ||
.dat* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
gem 'dotenv-rails' | ||
gem 'smtpapi' | ||
gem 'rest-client' | ||
source 'https://rubygems.org' | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require_relative "lib/sendgrid_ruby.rb" | ||
|
||
require 'dotenv' | ||
Dotenv.load | ||
|
||
sendgrid_username = ENV["SENDGRID_USERNAME"] | ||
sendgrid_password = ENV["SENDGRID_PASSWORD"] | ||
sendgrid_apikey = ENV["SENDGRID_APIKEY"] | ||
|
||
# client = SendGrid::Client.new(api_user: sendgrid_username, api_key: sendgrid_password) | ||
|
||
client = SendGrid::Client.new do |c| | ||
c.api_user = sendgrid_username | ||
c.api_key = sendgrid_password | ||
end | ||
|
||
mail = SendGrid::Mail.new do |m| | ||
m.to = '[email protected]' | ||
m.from = '[email protected]' | ||
m.subject = 'Hello world!' | ||
m.text = 'I heard you like pineapple.' | ||
end | ||
mail.add_attachment('/tmp/report.pdf', 'july_report.pdf') | ||
result = client.send(mail) | ||
puts result.code | ||
puts result.body | ||
|
||
# puts client.send(SendGrid::Mail.new(to: '[email protected]', from: '[email protected]', subject: 'Hello world!', text: 'Hi there, testing from Ruby!', html: '<b>Hi there, testing from Ruby!</b>')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters