async-email / async-smtp

Apache License 2.0
59 stars 12 forks source link

Rejects valid emails #43

Open bk2204 opened 3 years ago

bk2204 commented 3 years ago

The EmailAddress class uses the fast_chemail crate, which rejects emails that are valid according to RFCs 5322 and 6532:

    use async_smtp::EmailAddress;

    #[test]
    fn accepts_valid_email_addresses() {
        assert!(EmailAddress::new(r#""deliver able"@example.crustytoothpaste.net"#.into()).is_ok());
        assert!(EmailAddress::new("🔵@example.crustytoothpaste.net".into()).is_ok());
        assert!(EmailAddress::new("pingüino@example.crustytoothpaste.net".into()).is_ok());
        assert!(EmailAddress::new("sandals@example.crustytoothpaste.net".into()).is_ok());
    }

All of these addresses are deliverable (to me) if you remove the example.. Only the last is accepted.

Moreover, it appears that this library intentionally does not support the full range of valid email addresses:

A library to validate the email as it is defined in the HTML specification. The RFC 5322 is too lax (allowing comments, whitespace characters, and quoted strings in manners unfamiliar to most users) to be of practical use.

I should point out that the HTML specification is not involved in the sending of email and therefore what it defines as a valid email is totally irrelevant. Moreover, SMTPUTF8 is seeing increasing adoption, and the HTML specification rejects all internationalized email addresses, which is unhelpful since most people on the planet don't speak English at all.

A different implementation, supporting the full range of options specified in RFC 6532, should be used instead.

Jikstra commented 3 years ago

Could be fixed by https://github.com/async-email/async-smtp/commit/c8800625f7cf29f437143ac7e720ac2730a0962f @link2xt ?