Is the standard practice of blocking or resolving email addresses using "+"?

I want each user to register with a unique email address. However, some email addresses, such as GMail, allow you to add a + suffix, which can be used to register multiple accounts on a website, but this all refers to a single email address, for example.

  • bob@gmail.com sent to bob@gmail.com
  • bob+1@gmail.com sent to bob@gmail.com
  • bob+2@gmail.com sent to bob@gmail.com
  • bob+3@gmail.com sent to bob@gmail.com
  • bob+4@gmail.com sent to bob@gmail.com

Effectively, they can have as many email addresses as they want. This is a problem because my website treats it as 5 separate email addresses, but gmail treats them as one email address.

I was thinking of blocking any email addresses with a "+", but I don't want to block any valid email addresses. What is the standard practice?

+4
source share
2 answers

I do not think that there is standard practice on how to deal with this, except that it does not allow + all together. On the other hand, preventing this does not seem useful. To create a completely new email address on any free service will not take more than a few minutes if he really needs the one to whom you intend to block.

It should also be noted that many other email providers also provide subaddresses, but do not use the plus sign, but with a hyphen (Yahoo, Runbox, etc.), and trying to block this will only cause a problem for anyone who has only a hyphen email address. This is a war that you have already lost.

Also, if you filter out the plus signs, you are essentially not compatible with RFC3696 :

The exact rule is that any ASCII character, including control characters, can be displayed in quotation marks or in a quoted string. [...]

Without quotes, local parts can consist of any combination of alphabetic characters, numbers, or any special characters

  !  # $% & '* + - / =?  ^ _ `.  {|  } ~ 

But if you insist, you can simply exclude the plus part.

$emails = array(' bob@gmail.com ',' bob+1@gmail.com ',' bob+hello@gmail.com '); foreach ($emails as &$email) { list($identifier, $domain) = explode('@',$email); list($name) = explode('+',$identifier); $email = $name."@".$domain; } print_r($emails); 

The above will give you

 Array ( [0] => bob@gmail.com [1] => bob@gmail.com [2] => bob@gmail.com ) 
+4
source

Email identifiers can contain many characters that would not look right for us, I found a good stream here that could answer your request: What characters are allowed to an email address?

Also, to find a unique email id, just grab the first half of the email id and delete + and. characters and then check.

0
source

Source: https://habr.com/ru/post/1388948/


All Articles