开发者

Is there an alternative to email verification?

I don’t have access to a SMTP server without upgrading, which I can’t right now.

Is there any other method that I can use to ensure that users enter valid email addresses in my database. I have to go on a free web host (curre开发者_运维百科ntly xtreemhost) for at least the next few weeks. I just finished the site and want to test it first.

I use php-mysql for the website.


Introduction

You can validate the email's form, meaning you can tell if it's a valid email address, but you cannot check whether the email address actually exists.

Answer

As for the validation itself, there are many ways of doing it,

  • One would be to use filter_var()

     filter_var('bob@example.com', FILTER_VALIDATE_EMAIL)
    

Side Note: REGEX is not recommended to verify emails. If you do, Jon Skeet will come to you at night.


One of the things you can do is check if domain is valid via WHOIS lookup or ping. If somebody enters john@doe.com you try to whois lookup doe.com and ping that domain as well. If domain does not exists, email is not valid.

Also asking to type email twice does a good job for me - people stop making spelling mistakes in their emails.

Also good validation via regexp for an email is must-have.


Here is the list going from simplest to most accurate that I have seen most often.

  • Regex - check and make sure it is a valid email format. I have seen some good code snippets on Stack Overflow for this - free and simple but doesn't determine if the email, or even the domain, actually exists.

  • Check if the domain has an MX-Server - More accurate then regex since at least the domain is checked in realtime - free and fairly simple to implement but doesn't determine if the user exists.

  • Use a commercial solution - most accurate (verifies the actual email address is valid and can accept messages), simple to implement (REST/SOAP), but not free

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜