Work with case-sensitive email addresses

Closes #4235