10th video in the series about building cryptocurrency trading bot in Elixir 🎥 How to Deploy a Phoenix App to Gigalixir in 20 Minutes

Swoosh 1.1 Recipient Protocol

The Recipient Protocol enables you to easily make your structs compatible with Swoosh functions.

defmodule MyUser do
  @derive {Swoosh.Email.Recipient, name: :name, address: :email}
  defstruct [:name, :email, :other_props]
end

Now you can directly pass %MyUser{} to from, to, cc, bcc, etc. See Swoosh.Email.Recipient for more details.

https://hexdocs.pm/swoosh/Swoosh.Email.Recipient.html