Re: [PHP] Checking for a Valid Email String.

2003-03-15 Thread Justin French
on 14/03/03 2:09 AM, -{ Rene Brehmer }- ([EMAIL PROTECTED]) wrote:

 Jumping in...

Jumping in also:

http://www.killersoft.com/downloads/pafiledb.php?action=fileid=4

This is a PHP port of a well respected Perl script which CHECKS THE FORMAT
OF THE EMAIL ADDRESS AGAINST THE RCF SPEC.

I use it EVERYWHERE :)


Justin


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Checking for a Valid Email String.

2003-03-13 Thread -{ Rene Brehmer }-
Jumping in...

On Tue, 11 Mar 2003 20:19:36 -0500 (PET), David E.S.V. wrote about Re:
[PHP] Checking for a Valid Email String. what the universal translator
turned into this:

you mean something like this?

//checking if the email is valid

if 
(eregi(^[0-9a-z]([-_.]?[0-9a-z])[EMAIL PROTECTED]([-.]?[0-9a-z])*\\.[a-z]{2,3}$, 
$email, $check))
 {
  if ( !getmxrr(substr(strstr($check[0], '@'), 1), $validate_email_temp) )
$mensaje=server not valid;
  

  // checking DNS
  if(!checkdnsrr(substr(strstr($check[0], '@'), 1),ANY))
 $mensaje=server not valid;
 
 }

Now I haven't really checked up on ereg ... but besides I don't check with
DNS, can anyone tell me if my version (below), actually checks for all
possible invalids (I know I'm missing high-bit char tests)...

  function ValidEmail($email) {
  // function for verification of e-mail address
  // needs modification to test for high-bit chars
$invalidChars = array( ,/,:,,,;);
if ($email == ) {
  return false;
}
for ($n = 0; $n  count($invalidChars); $n++) {
  if (strpos($email,$invalidChars[$n]) != false) {
return false;
  }
}
$atPos = strpos($email,@,1);
if ($atPos === false) {
  return false;
}
if (strpos($email,@,$atPos + 1) != false) {
  return false;
}
$dotPos = strpos($email,.,$atPos);
if ($dotPos === false) {
  return false;
}
if ($dotPos + 3  strlen($email)) {
  return false;
}
return true;
  }

I created this a few months ago by converting a JS script, and haven't
really looked at it since. It works mostly like intended, but could
probably need some tweaking. It checks for all non-accepted chars, double
@s, and impossible dot-positions. It doesn't check for high-bit chars, and
doesn't actually verify the address. It's for subbing to my maillist, so
the mailserver actually does the verification itself.

Any comments ??? Or suggestions ???

Rene

-- 
Rene Brehmer

This message was written on 100% recycled spam.

Come see! My brand new site is now online!
http://www.metalbunny.net

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Checking for a Valid Email String.

2003-03-13 Thread -{ Rene Brehmer }-
On Wed, 12 Mar 2003 14:49:11 +1300, Philip J. Newman wrote about Re:
[PHP] Checking for a Valid Email String. what the universal translator
turned into this:

You have used the ' in sted of the  i assume that there is no difference?

The difference is that when you use , PHP looks for variables to be
filled in. With ' it doesn't...

I can't produce the correct results with ' though. Maybe it's because I'm
too used at basic and JS ... PHP is a tad different...

Rene

-- 
Rene Brehmer

This message was written on 100% recycled spam.

Come see! My brand new site is now online!
http://www.metalbunny.net

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Checking for a Valid Email String.

2003-03-13 Thread Julien Wadin
Here's a script I've made
The script checks if the mail looks like a valid one

?
if (checkmail($mail)) {
print(Adresse correcte);
} else {
print(Adresse invalide);
}


function checkmail($mail){
$mail2 = trim($mail);
$lg=strlen($mail2);
$pos1=strrpos($mail2,.);
$pos2=strrpos($mail2,@);
if(ereg(@,$mail2) and $pos1$pos2 and $lg5 and $pos2=1)
{
if (ereg( ,$mail2)) {
return false;
} else {
return true;
}
}
else
{
return false;
}
}
?


__
WADIN JULIEN
URL : www.campinfm.be.tf



-Message d'origine-
De : -{ Rene Brehmer }- [mailto:[EMAIL PROTECTED]
Envoyé : jeudi 13 mars 2003 16:13
À : Philip J. Newman; [EMAIL PROTECTED]
Objet : Re: [PHP] Checking for a Valid Email String.


On Wed, 12 Mar 2003 14:49:11 +1300, Philip J. Newman wrote about Re:
[PHP] Checking for a Valid Email String. what the universal translator
turned into this:

You have used the ' in sted of the  i assume that there is no difference?

The difference is that when you use , PHP looks for variables to be
filled in. With ' it doesn't...

I can't produce the correct results with ' though. Maybe it's because I'm
too used at basic and JS ... PHP is a tad different...

Rene

--
Rene Brehmer

This message was written on 100% recycled spam.

Come see! My brand new site is now online!
http://www.metalbunny.net

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Checking for a Valid Email String.

2003-03-11 Thread Philip J. Newman
Required: Help for checking for a valid email string.

--
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]

+64 (9) 576 9491
+64 021-048-3999

--
Friends are like stars
You can't allways see them,
but they are always there.

--
Websites:

PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]

Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]

Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED] 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Checking for a Valid Email String.

2003-03-11 Thread David E.S.V.


you mean something like this?


//checking if the email is valid

if 
(eregi(^[0-9a-z]([-_.]?[0-9a-z])[EMAIL PROTECTED]([-.]?[0-9a-z])*\\.[a-z]{2,3}$, 
$email, $check))
 {
  if ( !getmxrr(substr(strstr($check[0], '@'), 1), $validate_email_temp) )
$mensaje=server not valid;
  

  // checking DNS
  if(!checkdnsrr(substr(strstr($check[0], '@'), 1),ANY))
 $mensaje=server not valid;
 
 }


David.




On Wed, 12 Mar 2003, Philip J. Newman wrote:

 Required: Help for checking for a valid email string.
 
 --
 Philip J. Newman.
 Head Developer
 [EMAIL PROTECTED]
 
 +64 (9) 576 9491
 +64 021-048-3999
 
 --
 Friends are like stars
 You can't allways see them,
 but they are always there.
 
 --
 Websites:
 
 PhilipNZ.com - Design.
 http://www.philipnz.com/
 [EMAIL PROTECTED]
 
 Philip's Domain // Internet Project.
 http://www.philipsdomain.com/
 [EMAIL PROTECTED]
 
 Vital Kiwi / NEWMAN.NET.NZ.
 http://www.newman.net.nz/
 [EMAIL PROTECTED] 
 
 
 

-- 

David Elías Sánchez Vásquez
Bachiller en Educación PUCP
[EMAIL PROTECTED]
telf. (51)-1-5255601



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Checking for a Valid Email String.

2003-03-11 Thread Paul Chvostek
 On Wed, 12 Mar 2003, Philip J. Newman wrote:
 
  Required: Help for checking for a valid email string.

On Tue, Mar 11, 2003 at 08:19:36PM -0500, David E.S.V. wrote:
 
 you mean something like this?
 
 //checking if the email is valid
 
 if (eregi(^[0-9a-z]([-_.]?[0-9a-z])[EMAIL 
 PROTECTED]([-.]?[0-9a-z])*\\.[a-z]{2,3}$, $email, $check))
  {
   if ( !getmxrr(substr(strstr($check[0], '@'), 1), $validate_email_temp) )
 $mensaje=server not valid;
 
   // checking DNS
   if(!checkdnsrr(substr(strstr($check[0], '@'), 1),ANY))
  $mensaje=server not valid;
  
  }

Don't forget plus signs.  When providing email addresses to lists and
web sites, I regularly tag my address (as the From address on this
message demonstrates).  Using procmail for local delivery allows these
addresses to be delivered to my account, and I can more easily track
down the origin of tagged spam.  When I come across a web site or list
that doesn't allow my address with a plus sign, I find another site or
list.  So I use:

function isvalidemail($what) {
if 
(!eregi('[a-z0-9][a-z0-9._=+-]*@([a-z0-9][a-z0-9-]*\.)+[a-z][a-z]+$',$what)) 
return(false);
list($user,$domain) = explode(@,$what);
if (!getmxrr($domain,$mxhosts)) return(false);
if (!count($mxhosts)  0) return(false);
return(true);
}

-- 
  Paul Chvostek [EMAIL PROTECTED]
  Operations / Abuse / Whatever
  it.canada, hosting and development   http://www.it.ca/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Checking for a Valid Email String.

2003-03-11 Thread Philip J. Newman
how ever i don't think most ISPs let users pick names with the + sign in it

- Original Message -
From: Paul Chvostek [EMAIL PROTECTED]
To: David E.S.V. [EMAIL PROTECTED]
Cc: Philip J. Newman [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 2:37 PM
Subject: Re: [PHP] Checking for a Valid Email String.


  On Wed, 12 Mar 2003, Philip J. Newman wrote:
 
   Required: Help for checking for a valid email string.

 On Tue, Mar 11, 2003 at 08:19:36PM -0500, David E.S.V. wrote:
 
  you mean something like this?
 
  //checking if the email is valid
 
  if
(eregi(^[0-9a-z]([-_.]?[0-9a-z])[EMAIL PROTECTED]([-.]?[0-9a-z])*\\.[a-z]{2,3}$,
$email, $check))
   {
if ( !getmxrr(substr(strstr($check[0], '@'), 1),
$validate_email_temp) )
  $mensaje=server not valid;
 
// checking DNS
if(!checkdnsrr(substr(strstr($check[0], '@'), 1),ANY))
   $mensaje=server not valid;
 
   }

 Don't forget plus signs.  When providing email addresses to lists and
 web sites, I regularly tag my address (as the From address on this
 message demonstrates).  Using procmail for local delivery allows these
 addresses to be delivered to my account, and I can more easily track
 down the origin of tagged spam.  When I come across a web site or list
 that doesn't allow my address with a plus sign, I find another site or
 list.  So I use:

 function isvalidemail($what) {
 if
(!eregi('[a-z0-9][a-z0-9._=+-]*@([a-z0-9][a-z0-9-]*\.)+[a-z][a-z]+$',$what))
return(false);
 list($user,$domain) = explode(@,$what);
 if (!getmxrr($domain,$mxhosts)) return(false);
 if (!count($mxhosts)  0) return(false);
 return(true);
 }

 --
   Paul Chvostek [EMAIL PROTECTED]
   Operations / Abuse / Whatever
   it.canada, hosting and development   http://www.it.ca/





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Checking for a Valid Email String.

2003-03-11 Thread Philip J. Newman
You have used the ' in sted of the  i assume that there is no difference?

- Original Message -
From: Paul Chvostek [EMAIL PROTECTED]
To: David E.S.V. [EMAIL PROTECTED]
Cc: Philip J. Newman [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 2:37 PM
Subject: Re: [PHP] Checking for a Valid Email String.


  On Wed, 12 Mar 2003, Philip J. Newman wrote:
 
   Required: Help for checking for a valid email string.

 On Tue, Mar 11, 2003 at 08:19:36PM -0500, David E.S.V. wrote:
 
  you mean something like this?
 
  //checking if the email is valid
 
  if
(eregi(^[0-9a-z]([-_.]?[0-9a-z])[EMAIL PROTECTED]([-.]?[0-9a-z])*\\.[a-z]{2,3}$,
$email, $check))
   {
if ( !getmxrr(substr(strstr($check[0], '@'), 1),
$validate_email_temp) )
  $mensaje=server not valid;
 
// checking DNS
if(!checkdnsrr(substr(strstr($check[0], '@'), 1),ANY))
   $mensaje=server not valid;
 
   }

 Don't forget plus signs.  When providing email addresses to lists and
 web sites, I regularly tag my address (as the From address on this
 message demonstrates).  Using procmail for local delivery allows these
 addresses to be delivered to my account, and I can more easily track
 down the origin of tagged spam.  When I come across a web site or list
 that doesn't allow my address with a plus sign, I find another site or
 list.  So I use:

 function isvalidemail($what) {
 if
(!eregi('[a-z0-9][a-z0-9._=+-]*@([a-z0-9][a-z0-9-]*\.)+[a-z][a-z]+$',$what))
return(false);
 list($user,$domain) = explode(@,$what);
 if (!getmxrr($domain,$mxhosts)) return(false);
 if (!count($mxhosts)  0) return(false);
 return(true);
 }

 --
   Paul Chvostek [EMAIL PROTECTED]
   Operations / Abuse / Whatever
   it.canada, hosting and development   http://www.it.ca/





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Checking for a Valid Email String.

2003-03-11 Thread chris
On Wed, 12 Mar 2003 14:42:04 +1300, Philip J. Newman 
[EMAIL PROTECTED] wrote:

how ever i don't think most ISPs let users pick names with the + sign in 
it

- Original Message -
From: Paul Chvostek [EMAIL PROTECTED]
To: David E.S.V. [EMAIL PROTECTED]
Cc: Philip J. Newman [EMAIL PROTECTED]; php- 
[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 2:37 PM
Subject: Re: [PHP] Checking for a Valid Email String.


 On Wed, 12 Mar 2003, Philip J. Newman wrote:

  Required: Help for checking for a valid email string.
On Tue, Mar 11, 2003 at 08:19:36PM -0500, David E.S.V. wrote:

 you mean something like this?

 //checking if the email is valid

 if
(eregi(^[0-9a-z]([-_.]?[0-9a-z])[EMAIL PROTECTED]([-.]?[0-9a-z])*\\.[a- 
z]{2,3}$,
$email, $check))
  {
   if ( !getmxrr(substr(strstr($check[0], '@'), 1),
$validate_email_temp) )
 $mensaje=server not valid;

   // checking DNS
   if(!checkdnsrr(substr(strstr($check[0], '@'), 1),ANY))
  $mensaje=server not valid;

  }
Don't forget plus signs.  When providing email addresses to lists and
web sites, I regularly tag my address (as the From address on this
message demonstrates).  Using procmail for local delivery allows these
addresses to be delivered to my account, and I can more easily track
down the origin of tagged spam.  When I come across a web site or list
that doesn't allow my address with a plus sign, I find another site or
list.  So I use:
function isvalidemail($what) {
if
(!eregi('[a-z0-9][a-z0-9._=+-]*@([a-z0-9][a-z0-9-]*\.)+[a-z][a- 
z]+$',$what))
return(false);
list($user,$domain) = explode(@,$what);
if (!getmxrr($domain,$mxhosts)) return(false);
if (!count($mxhosts)  0) return(false);
return(true);
}
--
Paul Chvostek [EMAIL PROTECTED]
Operations / Abuse / Whatever
it.canada, hosting and development   http://www.it.ca/

What about those of us who run our own mailservers?  A plus sign is a valid 
character in an email address.  Doesn't matter if places like AOL don't let 
their users put it in their user's email addresses.  There's no point in 
*not* allowing it, since it *is* a valid character.

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Checking for a Valid Email String.

2003-03-11 Thread Justin French
on 12/03/03 12:42 PM, Philip J. Newman ([EMAIL PROTECTED]) wrote:

 how ever i don't think most ISPs let users pick names with the + sign in it

Doesn't matter... if it's a valid format of email address, then it should be
validated as legit.

I use this:
http://www.killersoft.com/downloads/pafiledb.php?action=fileid=4

Haven't had a single complaint.


The only true way to validate an address is for some to open the mail
account, read an email, and then respond.  Everything else just prevents
obvious mistakes, dummy address' and typos.


Justin French


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Checking for a Valid Email String.

2003-03-11 Thread Paul Chvostek

The original question was regarding email addresses, not usernames.
If an ISP has a policy of requiring each left-hand-side of an email
address to be a username, that ISP has a serious problem.


On Wed, Mar 12, 2003 at 02:42:04PM +1300, Philip J. Newman wrote:
 
 how ever i don't think most ISPs let users pick names with the + sign in it
 
  Don't forget plus signs.  When providing email addresses to lists and
  web sites, I regularly tag my address (as the From address on this
  message demonstrates).  Using procmail for local delivery allows these
  addresses to be delivered to my account, and I can more easily track
  down the origin of tagged spam.  When I come across a web site or list
  that doesn't allow my address with a plus sign, I find another site or
  list.  So I use:
 
  function isvalidemail($what) {
  if
 (!eregi('[a-z0-9][a-z0-9._=+-]*@([a-z0-9][a-z0-9-]*\.)+[a-z][a-z]+$',$what))
 return(false);
  list($user,$domain) = explode(@,$what);
  if (!getmxrr($domain,$mxhosts)) return(false);
  if (!count($mxhosts)  0) return(false);
  return(true);
  }

-- 
  Paul Chvostek [EMAIL PROTECTED]
  Operations / Abuse / Whatever
  it.canada, hosting and development   http://www.it.ca/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php