var W/ FILTER

I've searched this site for similar answers and I still can't make up my mind. Also I'm new to this site.

I'm in the process of developing a PHP script to allow users to register. After they register they are sent a email with a token to validate that they have access to that email saying it is valid and it will mark them as 'valid users' otherwise it will delete that entry after a set time. What I'm wondering is if a custom REGEX that I made (which works fairly good for the most part just needs tuning every now and then) or if filter_var with FILTER_VALIDATE_EMAIL is better than my custom REGEX. I know that if you send too many emails that bounce back you might be marked as a spammer site and my client wouldn't like that too much.

Anything else that might help would be great help to me.


I would use Filter_validte_email if you don't have a lot of experience validating email or writing regex. It is also important to remember that any regex or filter will not prevent emails that bounce back, they will only check to make sure the entered address looks like it should. Thus you will get a valid check on noaddress@nodomain.tld even though this clearly will not be delivered unless nodomain.tld happens to exist and there happens to be a user noaddress with a mail account there.

See How to check if an email address exists without sending an email?

链接地址: http://www.djcxy.com/p/16538.html

上一篇: var在PHP 5.3.8中

下一篇: var W / FILTER