📬 Send stunning emails in minutes.
Battle-tested email designs for every need - accessed, configured, and sent through a developer-minded API.
:squirrel: Tested in Production at Jellyswitch
Installation
Add this line to your application's Gemfile:
gem 'mail_hatch'
And run:
bundle install
And restart your web server.
Configuration
Put this into config/initializers/mail_hatch.rb
:
Rails.application.config.active_job.custom_serializers << MailHatchSerializer
Usage
Mail Hatch is designed to be a simple replacement for your Rails mailers. First, create a Mail Hatch instance:
mail_hatch = MailHatch.new(
api_key: <API_KEY>,
brand_color: "#dfdfdf",
debug: false,
dry_run: false,
sendgrid_api_key: <SENDGRID_KEY>,
ios_store_url: <IOS STORE URL>,
google_play_store_url: <GOOGLE PLAY STORE URL>,
title: "My Application",
address: "My Address"
)
Then you can invoke any of Mail Hatch's emails. For example, to send a notification email:
mail_hatch.notification(
to: "foo@bar.com",
from: "me@me.com",
subject: "You have a new message",
text: "<message body>")
Sending in the background with Active Job
- Ensure your background job worker process is running jobs from the
:default
queue. - Prefix your Mail Hatch invocations with
async_
. For example:async_notification(...)
.
TODO
- The
async_
prefix needs work - Add / link to official docs w/ list of comprehensive options
- Generator for initializer
- Previews?
- LICENSE
- link to ruby gem in readme