Project

General

Profile

Actions

Bug #17675

closed

t3lib_div::validEmail does not allow '+' in localpart of mail address

Added by Wolfgang Zenker about 17 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Category:
Miscellaneous
Target version:
-
Start date:
2007-10-12
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.1
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

class.t3lib_div.php provides the method validEmail() to check for validity of a given email address. Minor problem: The function does not accept plus-signs "+" in the localpart of email addresses; these are legal though and some people are using them.

(issue imported from #M6515)


Files

t3lib_div.patch (781 Bytes) t3lib_div.patch Administrator Admin, 2007-10-12 12:41

Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #20285: t3lib_div::validEmail seems to not validate all addresses correctlyClosedOliver Hader2009-04-06

Actions
Actions #1

Updated by Christian Kuhn about 17 years ago

Digging into this topic I had to find out that RFC2822 also allows several other characters like "*" and "^" in the local-part of an address. (Section 3.2.4, 3.4.1).
Furthermore the "." is only valid if its not at the beginning or end of the local-part. The current regex also does not reflect this. And the plus-sign has (if used) sometimes only the meaning of a tag-mechanism for filtering.

There is a nice article at http://en.wikipedia.org/wiki/E-mail_address and especially for the regex-matching I found http://www.regular-expressions.info/email.html . Tons of other articles can be found on the net.

Your patch is correct so far, no question. I personally think (but that does not mean anything) a subset of the spec will suffice, most people don't use any special characters anyway (except . and -), so I would prefer to stick to the current implementation. A real change would have to come up with a quite complicated regex, and even then this would either be a monster or a subset of the spec.

Actions #2

Updated by Wolfgang Zenker about 17 years ago

I'm aware that the regex is far from perfect. I'm asking to add the '+' sign specifically because some of our users make use of the '+' for tagging of mailaddresses.

Actions #3

Updated by Christian Kuhn about 17 years ago

I have tested your patch on trunk (with the tipafriend ext) and will give you a +1 on reading and testing if you submit it.

Actions #4

Updated by Christian Kuhn over 15 years ago

Resolved as duplicate of #20285

t3lib_div::validEmail now uses native PHP filter in 4.3

Actions #5

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF