get "/email/:address" do
from = Email.new(email: 'xiz2@andrew.cmu.edu')
to = Email.new(email: "#{params['address']}")
subject = 'test'
content = Content.new(type: 'text/plain', value: 'and easy to do anywhere, even with Ruby')
mail = Mail.new(from, subject, to, content)
sg = SendGrid::API.new(api_key: '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')
response = sg.client.mail._('send').post(request_body: mail.to_json)
puts response.status_code
puts response.body
puts response.headers
end
Click to Expand
Content Rating
Is this a good/useful/informative piece of content to include in the project? Have your say!
You must login before you can post a comment. .