Jump to content

Email Verfication


NoobLaPHP
Go to solution Solved by 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
Share on other sites

  • Solution

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('user@davidwalsh.name')) {
	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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.