View Source Swoosh.Mua

Hex Package Hex Docs

Swoosh adapter for Mua.

Installation

defp deps do
  [
    {:swoosh_mua, "~> 0.1.0"}
  ]
end

Usage

# for supported configuration, please see https://hexdocs.pm/mua/Mua.html#t:option/0
Application.put_env(:example, Mailer, adapter: Swoosh.Mua)

defmodule Mailer do
  use Swoosh.Mailer, otp_app: :example
end

email =
  Swoosh.Email.new(
    from: {"Mua", "mua@github.com"},
    to: {"Receiver", "receiver@mailhog.example"},
    subject: "how are you?",
    text_body: "I'm fine",
    html_body: "I'm <i>fine</i>"
  )

Mailer.deliver(email)