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
7 Likes
Swoosh 1.4 released with a built-in Finch-based API client. (it has always had a hackney-based one)
Now you can pick either hackney
or finch
.
If you implement a custom API client, you can use anything else
## Changelog
## 1.4.0
### Add `Swoosh.ApiClient.Finch`
You can configure what API Client to use by setting the config. Swoosh comes with
`Swoosh.ApiClient.Hackney` and `Swoosh.ApiClient.Finch`
```elixir
config :swoosh, :api_client, MyAPIClient
```
It defaults to use `:hackney` with `Swoosh.ApiClient.Hackney`. To use `Finch`, add the below config
```elixir
config :swoosh, :api_client, Swoosh.ApiClient.Finch
```
To use `Swoosh.ApiClient.Finch` you also need to start `Finch`, either in your supervision tree
This file has been truncated. show original
6 Likes
Neat! I saw it the other day but I saw it was hardcoded to Swoosh.Finch
, wasn’t aware that I can switch it.
By the way slightly unrelated, are we typically meant to start a new Finch instance for every endpoint we connect to for the performance?
Not really. A Finch instance can handle multiple pools. Unless message passing is becoming the bottleneck (not likely), you shouldn’t have to start multiple of them.
From Finch documentation:
{Finch,
name: MyConfiguredFinch,
pools: %{
:default => [size: 10],
"https://hex.pm" => [size: 32, count: 8]
}}
3 Likes
Thanks I missed that out in the documentation, I thought there is only one pool per instance but looks like Finch can start multiple per host, that’s awesome!
Unlocked 1k achievement today.
7 Likes
1.5 released with Telemetry support.
5 Likes
1.6 released a few days ago.
Features
allow custom CIDs for inline attachments @taobojlen (#665)
add OhMySMTP adapter @taobojlen (#663)
And a ton of documentation updates.
2 Likes