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.
Read next 🎥 How to Deploy a Phoenix App to Gigalixir in 20 Minutes