...

View Full Version : How do i tell my php to check if the email is valid?



webjoker
01-21-2012, 05:29 PM
Hello,

I've done a PhP code to send a mail when i click at a submit button. But a problem is that i can type any email adress even if it's valid or not valid. So my question is, how do i tell my PhP code to check if that email exists.

Regards: Webjoker

mlseim
01-21-2012, 05:53 PM
You really can't.

Unless you email a code to the user, and they have to check their email to confirm.
You've probably experienced that tons of times.

You can validate it though.
Make sure the structure is correct xxx@xxx.xxx
with the @ and . in the proper order and they exist.

Another way is to extract the part after @ and ping or try to open
a file on that website. Usually, the part after @ is a domain.
Like: @yahoo.com or @msn.com or @gmail.com
You see if the "email" domain part is valid.
If I were to enter "mlseim@dfslkjf.com" ... dfslkjf.com is not a valid domain,
so I'm probably lying about my email address.

That's about the best you can do.

.

_Aerospace_Eng_
01-21-2012, 06:41 PM
You could also try using checkdnsrr

felgall
01-21-2012, 09:35 PM
You could try sending an 'EHLO ' or 'VRFY: ' request to their mail server to see if it will respond that the email address exists. This is unlikely to work though as most mail servers now block responding to those types of request as it makes it too easy for spammers to find out what addresses exist on a given domain.

tangoforce
01-21-2012, 09:38 PM
You could try sending an 'EHLO ' or 'VRFY: ' request to their mail server to see if it will respond that the email address exists. This is unlikely to work though as most mail servers now block responding to those types of request as it makes it too easy for spammers to find out what addresses exist on a given domain.

I had code for that, I tried it on a range of addresses in my contacts and only about 15-20% gave a usable answer. In short, it's pointless. The best way is send a link and let the user validate it.

webjoker
01-21-2012, 09:49 PM
Thank you for all of your answer, i will read what u've typed. And try to make the best out of it! Thank you all...

felgall
01-21-2012, 10:35 PM
I had code for that, I tried it on a range of addresses in my contacts and only about 15-20% gave a usable answer. In short, it's pointless. The best way is send a link and let the user validate it.

I agree. I am surprised that you got such a high percentage of responses as that. I only got about that level of responses about five years ago when I tried it and i would have thought the percentage would be lower by now.

I agree that the only effective way is a link in the email for the person to click on to acknowledge that they received the email and actually wanted to receive more.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum