Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5
This is the forum to discuss the Wrox book Beginning PHP4 by Wankyu Choi, Allan Kent, Chris Lea, Ganesh Prasad, Chris Ullman; ISBN: 9780764543647
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 29th, 2004, 03:29 AM
Authorized User
 
Join Date: Jul 2004
Location: glasgow, , United Kingdom.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Validate Email address

Hi

I want to validate that an email address is not syntactically coreect (i.e. xxxxx @ yyyy . zzzz) but to prove that the address exists.

Is there any way to do this ?

regards

richard t-r

Reply With Quote
  #2 (permalink)  
Old September 29th, 2004, 09:51 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Use regular expressions. But do you mean search to see if an email address is taken by an actual person?
Reply With Quote
  #3 (permalink)  
Old September 29th, 2004, 10:09 AM
Authorized User
 
Join Date: Jul 2004
Location: glasgow, , United Kingdom.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Exactly, to see if the email address exists,
or at least the domain i.e. the bit after the @ e.g. tdoc.net.

thanks

Reply With Quote
  #4 (permalink)  
Old September 29th, 2004, 10:18 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

There is no way to verify the email address without user action. You can ping the domain and make sure the domain exists, but beyond that you'd have to send the user an email with a verification code or something like that to verify the address itself.

Regards,
Rich

--
[http://www.smilingsouls.net]
[http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
Reply With Quote
  #5 (permalink)  
Old September 29th, 2004, 02:24 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Yes, domains don't have accessible lookups online.
Reply With Quote
  #6 (permalink)  
Old November 23rd, 2004, 01:33 PM
Registered User
 
Join Date: Nov 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was wondering if there is a way to check for spaces inside an email address?

Reply With Quote
  #7 (permalink)  
Old November 23rd, 2004, 01:45 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

> I was wondering if there is a way to check for spaces inside an email address?

There are several ways of validating an email address (from a syntactical standpoint).

I've used something like this in the past, and it works pretty well.

Code:
function is_email($email)
{
    return ereg("^[^@ ]+@[^@ ]+\.[^@ ]+$", $email);
}
If you just want to check for the presence of space, do something like the following:
Code:
if (strstr(trim($email), ' '))
{
    // The email contains single space characters
}
else
{
    // The email does not contain space characters
}
(This doesn't find tabs BTW)

HTH!

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
validate email address dartcoach Javascript 0 April 28th, 2008 12:58 PM
Validate multiple email addresses mat41 Javascript 1 August 29th, 2007 12:45 AM
How to validate email address crmpicco Javascript How-To 2 February 16th, 2005 10:56 AM
Email Validate nskannan2007@yahoo.com Javascript How-To 3 July 3rd, 2003 11:46 PM
Email Validate nskannan2007@yahoo.com HTML Code Clinic 3 June 9th, 2003 10:49 AM



All times are GMT -4. The time now is 12:24 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.