posty / posty_api

Utility to administrate mailserver based on postfix and dovecot
www.posty-soft.org
Other
85 stars 19 forks source link

Underscore is incorrectly not allowed in user names #36

Closed somebee closed 8 years ago

somebee commented 8 years ago

https://github.com/posty/posty_api/blob/master/app/models/virtual_user.rb#L11

From wikipedia:

The local part of the email address may use any of these ASCII characters:

  • uppercase and lowercase Latin letters A to Z and a to z;
  • digits 0 to 9;
  • special characters !#$%&'*+-/=?^_`{|}~;
  • dot ., provided that it is not the first or last character unless quoted, and provided also that it does not appear consecutively unless quoted (e.g. John..Doe@example.com is not allowed but "John..Doe"@example.com is allowed);
  • space and "(),:;<>@[] characters are allowed with restrictions (they are only allowed inside a quoted string, as described in the paragraph below, and in addition, a backslash or double-quote must be preceded by a backslash);
  • comments are allowed with parentheses at either end of the local part; e.g. john.smith(comment)@example.com and (comment)john.smith@example.com are both equivalent to john.smith@example.com.

As you can see from link to the actual code above, posty is currently supporting a very strict subset of this. At the very least it should allow underscores, as they are actually used quite frequently in the real world.