# StrawHat.Mailer

Email Management with templating capability. The templates use Mustache template
under the hood so you can do everything that the template system allow you to do.

## Installation

def deps do
    {:straw_hat_mailer, "~> 0.3"}

### Configuration

We need to setup `Swoosh` adapter to be able to send the emails and the database
for save the templates.

# In your config files
config :straw_hat_mailer, StrawHat.Mailer,
  adapter: Swoosh.Adapters.Sendgrid,
  api_key: "SG.x.x"

config :straw_hat_mailer, StrawHat.Mailer.Repo,
  adapter: Ecto.Adapters.Postgres,
  database: "straw_hat_mailer",
  hostname: "localhost",
  username: "postgres",
  password: "postgres"

## Usage

StrawHat.Mailer use `Swoosh` under the hood. The next example shows how to create
an email using specific template.

token = get_token()
from = {"ACME", ""}
to = {"Straw Hat Team", ""}
data = %{
  confirmation_token: token

{:ok, email} =
  |> StrawHat.Mailer.Email.with_template("welcome", data)