Why does filter_var($email, FILTER_VALIDATE_EMAIL) allow test@test?

前端 未结 4 1787
忘了有多久
忘了有多久 2021-02-08 07:00

I was just setting up the validation for a form in which I decided to try using the filter_var function to check the validity of my email address. I can not find out what filter

4条回答
  •  孤街浪徒
    2021-02-08 07:56

    No, test can be a local / internal network domain, so that would work. I like it that it correctly validates wrikken@localhost when developing for instance.

    A normal nonexistentdomain.foo would have the same problem. If you want to test whether something is delivarable to a host, use getmxrr (and it that fails fall back to gethostbyname()).

提交回复
热议问题