Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMTPConnection.prototype._parseAddressCommand is not compliant to RFC 5322 #5

Closed
jkramarz opened this issue Sep 12, 2016 · 3 comments
Closed

Comments

@jkramarz
Copy link

It seems to be implementing a bit of RFC 6530 to allow internationalization of email addresses (unicode), but unfortunately it renders RCPT TO parsing invalid:

  • addresses with quotes (eg. rcpt to: <"much.more unusual"@example.com> are rejected with 501 Error: Bad recipient address syntax)
  • addresses with non-latin characters too (eg. rcpt to: <δοκιμή@παράδειγμα.δοκιμή> rejected with 553 The recipient address <δοκιμή@παράδειγμα.δοκιμή> is not a valid RFC-5321 address.,
    Resolving the first nonconformance may reveal another problem: onRcptTo expects only one @ character in email address.
@andris9
Copy link
Member

andris9 commented Sep 13, 2016

"much.more unusual" fails here because of the whitespace in username part.

I also checked how gmail treats this and these are the results:

C: rcpt to:<"test"@kreata.ee>
S: 250 2.1.5 OK g99sm2688209lji.43 - gsmtp
C: rcpt to:<"test address"@kreata.ee>
S: 553-5.1.2 The recipient address <test address@kreata.ee> is not a valid RFC-5321
S: 553 5.1.2 address. g99sm2688209lji.43 - gsmtp
C: rcpt to:<"test@address"@kreata.ee>
S: 553-5.1.2 The recipient address <test@address@kreata.ee> is not a valid RFC-5321
S: 553 5.1.2 address. g99sm2688209lji.43 - gsmtp

So quoted usernames are allowed but whitespaces or @ symbols inside the username are not. I know that Gmail is not the purest reference but usually it is good enough.

I updated RCPT verification rules to allow usernames in quotes (b3f18f3), so this should match the behavior of Gmail more or less. if anyone would mind making it more RFC complaint then it would be great but for now it is good enough.

The issue with unicode addresses is clearly a bug, I'm going to look into it to get it working.

@andris9
Copy link
Member

andris9 commented Sep 13, 2016

ZoneMTA in it's own is able to handle unicode addresses just fine. The problem is that such address does not pass the isemail validation test which seems to be described in this issue: skeggse/isemail#17

For now I monkey-patched unicode support into ZoneMTA by just replacing any unicode range characters in email addresses before validating these with isemail bb6557f. I hope that in the future isemail starts accepting and validating unicode character by itself.

@andris9
Copy link
Member

andris9 commented Nov 13, 2016

For now there is not going to be support for quoted addresses that include spaces even though the spec would allow it. If this is something you actually would need, eg. there are real people out there who are not able to use ZoneMTA because of this restriction, then let me know.

@andris9 andris9 closed this as completed Nov 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants