Rewrites the addresses in an RFC 5322 address list (the value of
From:, To:, Cc:, and similar fields) and keeps every other byte:
display names, comments, groups, and folding.
iex> Sovite.Message.AddressList.rewrite(~s|"Alice (work)" <alice@host.example.com>, bob@x|, &String.upcase/1)
~s|"Alice (work)" <ALICE@HOST.EXAMPLE.COM>, BOB@X|fun gets each address as written (local@domain) and returns the
replacement. Anything that does not parse as an address is left alone,
so a malformed field passes through unchanged.
Summary
Functions
Returns the addresses in value (local@domain, as written), in
order, or :error if a quoted string, comment, or angle address is
not closed. Display names, comments, and group names are skipped;
what does not parse as an address is left out, as rewrite/2 leaves
it alone.
Rewrites each address in value with fun.
Rewrites the addresses in a whole header field ("To: a@b\r\n"), as
kept by Sovite.Message.Headers.
Functions
Returns the addresses in value (local@domain, as written), in
order, or :error if a quoted string, comment, or angle address is
not closed. Display names, comments, and group names are skipped;
what does not parse as an address is left out, as rewrite/2 leaves
it alone.
iex> Sovite.Message.AddressList.addresses(~s|"Doe, J" <j@x.example>, Team: k@y;|)
{:ok, ["j@x.example", "k@y"]}
Rewrites each address in value with fun.
Rewrites the addresses in a whole header field ("To: a@b\r\n"), as
kept by Sovite.Message.Headers.