Does PHP's filter_var FILTER_VALIDATE_EMAIL actually work?

前端 未结 4 2034
一个人的身影
一个人的身影 2020-11-27 16:23

After reading various posts I decided not to use REGEX to check if an email is valid and simply use PHP\'s inbuilt filter_var function. It seemed to work ok, until it starte

4条回答
  •  抹茶落季
    2020-11-27 17:18

    name2@domain.com seems to work fine: http://codepad.org/5HDgMW5i

    But I've definitely seen people complaining it's got problems, even on SO. In all likelihood, it does have problems, but so will a regex solution. The email address specifications are very, very complicated (RFC XXXX).

    That's why the only solution to verify emails you should rely on is sending an email to the address and demand action (eg: if it's a registration script ask them to click on a verification link).

提交回复
热议问题