panthershark / email-parser / Email

Email parser and validation library.


type alias EmailAddress =
{ local : String
, domain : String 
}

A model for representing an email. This is exposed, but you'll probably only use it is using parseEmailAddress

isValid : String -> Basics.Bool

Given a string, this returns true if the email is compatible with the spec.

    isValid "hello@world.com" == True
    isValid "^^^^" == False

parse : String -> Result (List Parser.DeadEnd) EmailAddress

Given a string, parses into an EmailAddress model.

    parse "hello@world.com" == Ok { local = "hello", domain = "world.com" }
    parse "^^^^" == Err [ dead ends ]

toString : EmailAddress -> String

Converts the EmailAddress model to a string.