Hi all,
Looks like the original authors of Swoosh never posted it here.
I just released Swoosh 1.1.0, and here I am.
1.1 adds Recipient Protocol with @derive
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
Po Chen