HttpMailer
Send emails via Mailgun, Mandrill and SendGrid HTTP APIs.
Installation
Add this line to your application's Gemfile:
gem 'http_mailer'
And then execute:
$ bundle
Or install it yourself as:
$ gem install http_mailer
Usage
Mailgun
mailgun_client = HttpMailer.mailgun({
host: "api.mailgun.net",
api_key: "XXXXXXXXX",
subdomain: "samples.mailgun.net"
})
from = "Excited User <[email protected]>"
to = "[email protected]"
subject = "Hello"
text = "Testing some Mailgun awesomness!"
mailgun_client.(from, to, subject, text)
Mandrill
mandrill_client = HttpMailer.mandrill({
host: "mandrillapp.com",
api_key: "XXXXXXXXX"
})
from = "[email protected]"
from_name = "Ernest Hemingway"
to = "[email protected]"
to_name = "JD Salinger"
subject = "Hello"
text = "Every man's life ends the same way. \
It is only the details of how he lived and \
how he died that distinguish one man from another."
mandrill_client.(from, to, subject, text, to_name, from_name)
SendGrid
sendgrid_client = HttpMailer.sendgrid({
host: "sendgrid.com",
api_user: "username",
api_key: "XXXXXXXXX"
})
from = "[email protected]"
from_name = "Johnny Cash"
to = "[email protected]"
to_name = "Elvis Presley"
subject = "Hello"
text = "Success is having to worry about every damn thing in the world, except money."
sendgrid_client.(from, to, subject, text, to_name, from_name)
Contributing
- Fork it ( https://github.com/[my-github-username]/http_mailer/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request