php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16655 Function for checking if email-adress is valid
Submitted: 2002-04-17 07:01 UTC Modified: 2002-04-18 07:19 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: metz at speedpartner dot de Assigned:
Status: Closed Package: PEAR related
PHP Version: 4.1.2 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: metz at speedpartner dot de
New email:
PHP Version: OS:

 

 [2002-04-17 07:01 UTC] metz at speedpartner dot de
There are several reg.exp. around in Internet, but I'd like to see a function which checks if a string is a valid email-adress (is_email or valid_email or so)

Here is the regex:
^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@('.'([-!#$%&\'*+\\/0
-9=?A-Z^_`a-z{|}~]+\.)'.'([-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$))'

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-17 07:19 UTC] bate@php.net
function validEmail($email_adresse) {
		if (eregi('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@('.'([-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.)'.'([-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$))', $email_adresse, $found)) {
			if (getmxrr($found[1], $mx_records)) {
				return $mx_records;
			}
		}
		return false;
}

this is php function to check an email about validity and existing mx records. :)
 [2002-04-17 10:11 UTC] jtate@php.net
Probably belongs in PEAR not PHP, along with the URL-ize function mentioned in a bug report yesterday (#16642).  Now... Which module does it belong in?
 [2002-04-17 10:13 UTC] metz at speedpartner dot de
but isn't it possible to add this function to the "standard repertoir" of php?

I think many people will use it and at the moment everyone writes his own "version" of this function.
 [2002-04-17 10:23 UTC] cynic@php.net
everything's possible, but PEAR is part of the "standard repertoire",
so you should be happy. :)

 [2002-04-17 12:36 UTC] metz at speedpartner dot de
you don't know how happy I am ;))
 [2002-04-17 16:19 UTC] mfischer@php.net
This belongs into PEAR (if at all).
 [2002-04-17 16:36 UTC] richard@php.net
There's already Mail/RFC822.php
 [2002-04-17 20:32 UTC] cox@php.net
It's wrong to only check the MX address as many domains don't have it (it's not a requirement). The CNAME has to be checked too.
 [2002-04-18 05:24 UTC] hholzgra@php.net
a public mail server for a domain 
that does operate *without* MX records 
does not deserve to be taken serious IMHO

how do you implement fallback servers without
MX records?

and even if you say and A or CNAME record is
enough, how do you check that the machine with
that ip does really accept mail? by probing
the SMTP port all the time?

hartmut@www.six.de might be a legal address by
the CNAME rule, but i can assure you that mail
to that address will never reach me

so no MX -> no mail makes sense IMHO
 [2002-04-18 07:19 UTC] cox@php.net
I read some time ago a study done by a consultancy and the amount of domains without MX was terrible high (~20% of the domains audited). That's why I'm saying that. Of course all the "easy" e-mail verifications one can do, is only the half part as you can't check if the user really exists/is enabled or if the mail server is really there and accepting the emails for that domain (but we all knows that).
 [2004-05-10 20:53 UTC] raman at e11online dot com
How can i check
 [2004-05-10 20:54 UTC] raman at e11online dot com
how can i check version of database(say MySQL) thru PHP? Is there any function to check this in php
 [2004-09-13 22:10 UTC] phpengineer at yahoo dot com
[10 May 8:54pm CEST] raman at e11online dot com 
Dear Raman,

You can use <? phpinfo(); ?> function to know about the version and other details.

PHP Programmer
INDIA
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC