Skip to content

Email address parsing and validation library for Elixir.

License

Notifications You must be signed in to change notification settings

synchronal/ex_email

Repository files navigation

ExEmail

Helpers for parsing and validating email addresses.

Usage

Add ExEmail to your mix project deps:

{:ex_email, "~> 0.1"}

An email address may be parsed into its local and domain parts via ExEmail.parse/1:

iex> ExEmail.parse("[email protected]")
{:ok, {"alice", "example.com"}}
iex> ExEmail.parse("@example.com")
{:error, ExEmail.Error.new("parse error", "@example.com")}

If the values of the parts are not important, just the validity of the address, then ExEmail.validate/1 may be used:

iex> ExEmail.validate("[email protected]")
:ok
iex> ExEmail.validate("@example.com")
{:error, ExEmail.Error.new("parse error", "@example.com")}

References

This library pulls heavily from the email_validator Erlang library, which is great but no longer seems to be maintained.

About

Email address parsing and validation library for Elixir.

Resources

License

Stars

Watchers

Forks

Packages

No packages published