Current section

Files

Jump to
ex_postmark lib ex_postmark adapters test.ex
Raw

lib/ex_postmark/adapters/test.ex

defmodule ExPostmark.Adapters.Test do
@moduledoc ~S"""
An adapter that sends emails as messages to the current process.
This is meant to be used during tests.
## Example
# config/test.exs
config :sample, Sample.Mailer,
adapter: ExPostmark.Adapters.Test
# lib/sample/mailer.ex
defmodule Sample.Mailer do
use ExPostmark.Mailer, otp_app: :sample
end
"""
use ExPostmark.Adapter
def deliver(email, _config) do
send(self(), {:email, email})
{:ok, %{}}
end
end