In theory emails are case sensitive. But using emails as system login I want them to be all lower case (i.e. [email protected] and [email protected] cannot be different users).
Can this be a problem for some users who use case sensitivity in their email address? Does somebody use it out there?
Edit: Because there are many "preserve case on save, ignore on login" answers: This system would break if I really had two different users john@smith and John@smith, wouldn't it?
Example: john@smith and John@smith have the password 123. How do I know which one just authenticated?
If you're wondering, “do capital letters matter in email addresses?”, the simple answer here is no. Capitals don't really matter in email addresses. They aren't case-sensitive, unlike passwords. That's because modern mail servers essentially ignore capital letters.
So, Are Emails Case Sensitive? No. Email addresses are not case sensitive. If your email address is [email protected] but someone enters it in all lowercase letters, you're still going to receive the email.
No, email addresses are not case sensitive. Whether you enter an email like this “[email protected]”, like this “[email protected]”, or like this “[email protected]”, it doesn't make an iota of difference.
Yes, according to RFC 5321, the local part is case sensitive. However, Email Service Providers (ESPs) widely recognize that allowing upper case letters can lead to unnecessary confusion. That's why most ESPs limit the options available to users when creating an email address.
Don't throw away data. Store the email address or username exactly as you received it, with the exception of trimming both ends of the string.
When sending email, use the case that was supplied by the user. Just because case-sensitivity is rare is no reason to not handle it - otherwise that user gets no mail, and can possibly not even register.
When authenticating a user, you can optionally do a compare on lower case (or upper case) strings, so that the case is disregarded.
So, by preserving the user input data you have suddenly given yourself options: whether to do case-sensitive compares on authentication, and whether to use case-sensitive email addresses when sending mail. Even if you don't choose to avail yourself of them now, the purpose of preserving data is to allow you (or some other developer) to have those choices down the road.
According to RFC 2821:
The local-part of a mailbox MUST BE treated as case sensitive. Therefore, SMTP implementations MUST take care to preserve the case of mailbox local-parts. Mailbox domains are not case sensitive. In particular, for some hosts the user "smith" is different from the user "Smith". However, exploiting the case sensitivity of mailbox local-parts impedes interoperability and is discouraged.
So, while you can treat emails addresses with case sensitivity, you are discouraged from doing so.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With