public
Created

Displays Sendgrid statistics for Heroku apps

  • Download Gist
email.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
class Heroku::Command::Sendgrid < Heroku::Command::Base
def test_email
app = extract_app
vars = heroku.config_vars(app)
to = ''
args.each do |arg|
key, value = arg.split("=")
to = value if key == "to"
end
 
if to.empty?
error "please specify an address to send to using to=<me@example.com>"
else
resource = RestClient::Resource.new("https://test-mail.heroku.com")
display resource["/mail"].post(:sendgrid_username => vars["SENDGRID_USERNAME"],
:sendgrid_password => vars["SENDGRID_PASSWORD"],
:sendgrid_domain => vars["SENDGRID_DOMAIN"],
:to => to)
end
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.