Jump to content

If Not Email Address


computermax2328

Recommended Posts

Hello All,

 

If I have a newsletter process script with name and email, is there a way to identify if the email is an email address? For example johndoe@gmail.com.

 

I kind of want to think of a way to identify if it is a real name as well. Maybe just ask for first and last name.

 

Thanks,

Link to comment
Share on other sites

You could use a regular expression to see if the string is in a valid email address format. It doesn't however guarantee it is an actual email address.

 

That is why sites use email verification. If you want force your users into supplying an email address that works, you need to verify it up front.

Link to comment
Share on other sites

They have a PHP command for everything. I love PHP!

 

In the simplest form, something like this??

$email = $_GET['email'];
if(filter_var($email, FILTER_VALIDATE_EMAIL) === FALSE) {
echo "This is not a valid email";
}
else {
mail($email, "Please Validate");
}

 

I understand there are no headers or message.

Edited by computermax2328
Link to comment
Share on other sites

They have a PHP command for everything. I love PHP!

 

In the simplest form, something like this??

$email = $_GET['email'];
if(filter_var($email, FILTER_VALIDATE_EMAIL) === FALSE) {
echo "This is not a valid email";
}
else {
mail($email, "Please Validate");
}

 

I understand there are no headers or message.

The PHP function checks if the email address is correctly build up.

But it doesn't say anything if the domain name exists.

 

I wrote a small example, which after the PHP check also checks if the domain name exists:

 

http://www.wmappz.com/php/validate-email-address/

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.