An RFC 5322 compliant email address parser.
You can parse string for email address like this.
```rust use emailaddressparser::EmailAddress;
let email = EmailAddress::parse("foo@bar.com", Some(true)).unwrap(); asserteq!(email.getlocalpart(), "foo"); asserteq!(email.get_domain(), "bar.com"); ```
For an input string that is an invalid email address, it returns None
.
```rust use emailaddressparser::EmailAddress;
assert!(EmailAddress::parse("test@-iana.org", Some(true)).is_none()); ```
To parse an email address with obsolete parts (as per RFC 5322) in it, pass None
as the second argument to have non-strict parsing.
rust
let email = EmailAddress::parse("\u{0d}\u{0a} \u{0d}\u{0a} test@iana.org", None);
assert!(email.is_some());