Jump to content

Email Verfication


NoobLaPHP

Recommended Posts

Ok, i am having a load of people register to a subscription service on my website using invalid emails. I would like to add a function in that can read an email. If the source is right it will continue to process the form. If it's not then it shows an error message.

 

Would i use something like an explode function to seperate using the @ in an email and read the end part(live.co.uk) and then have an array set up to see if the end is in the email or what? 

 

Examples would be a great help if you have any other ideas.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/286715-email-verfication/
Share on other sites

I have found this that seems to work well.

function domain_exists( $email, $record = 'MX' ) {
	list( $user, $domain ) = explode( '@', $email );
	return checkdnsrr( $domain, $record );
}


if(domain_exists('[email protected]')) {
	echo('This MX records exists; I will accept this email as valid.');
}
else {
	echo('No MX record exists;  Invalid email.');
}

Source: http://davidwalsh.name/php-email-validator

Link to comment
https://forums.phpfreaks.com/topic/286715-email-verfication/#findComment-1471507
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.