Make WordPress Core

Opened 10 months ago

Closed 8 months ago

Last modified 5 months ago

#59156 closed enhancement (wontfix)

sanitize_email method should lowercase the given email

Reported by: achchu93's profile achchu93 Owned by:
Milestone: Priority: normal
Severity: minor Version: 6.3
Component: Formatting Keywords: reporter-feedback
Focuses: Cc:


Currently sanitize_email method doesn't lowercase the given email. An email should in lowercase letters. As this is a formatting method I believe lowercasing it will help out.

Change History (5)

#1 @rajinsharwar
10 months ago

  • Keywords reporter-feedback added

Hi @achchu93, welcome to WordPress Trac, and thanks for your ticket.

Can you please explain the necessity of this feature? Because currently, all the emails are always treated in lowercase. So, for example, you have a user with the email "rajin@…". After that, when you try to create another user with "RAJIN@…", it will show the error that you are trying to use an already used email.

Also, if you try to log in with "RAJIN@…", you will be able to log in to the account. So, I am not quite sure what's the necessity of this proposed function. Feel free to add your thoughts here.

#2 @achchu93
10 months ago

Okay, lets say I am sending 'Ahamed@…' as my email. This method sanitize and returns it with the capital letter it already had. If I want to save the email as a meta, I have to lowercase it again. Lets say if I have saved the email in Capital letters I have to use this method and again I have to run lowercase function. As this is a formatting helper function it would be great if we can get the output in lowercase. So we don't have to use strtolower function everywhere in the plugin. One single formatting function will do whatever it requires for the email.

#3 @roytanck
10 months ago

As far as I know, Capitalization is allowed in email addresses. It is usually ignored (like WP does), but the official standard does not require email addresses to be lowercase.

Since sanitize_email is intended to make sure an email address conforms to the standard, I do not believe it should convert the input to lowercase.

#4 @ramon fincken
8 months ago

  • Resolution set to wontfix
  • Status changed from new to closed

@roytanck Correct, see

therefore these are valid, examples taken from the RFC

#5 @swissspidy
5 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.