send text or html by mailgun.
-
Add the dependency to your
shard.yml
:dependencies: mailgun-crystal: github: Shy07/mailgun-crystal
-
Run
shards install
require "mailgun-crystal"
client = MailgunCrystal::Client.new(
api_key: api_key,
domain: DOMAIN
)
res = client.send_text(
from: "Excited User <[email protected]>",
to: %w([email protected] YOU@YOUR_DOMAIN_NAME),
subject: "Hello",
content: "Testing some Mailgun awesomness!"
)
#
# => or send html
#
# res = client.send_html(
# from: "Excited User <[email protected]>",
# to: %w([email protected] YOU@YOUR_DOMAIN_NAME),
# subject: "Hello",
# content: "<h1>Testing some Mailgun awesomness!</h1>"
# )
p res # => {
# "status_code" => 200 if success,
# "id" => mailgun id if success,
# "message" => success message or error message
# }
- Fork it (https://github.com/Shy07/mailgun-crystal/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
- HSU Rynki - creator and maintainer