Jump to content

Recommended Posts

View the header,

ie

 

MIME-Version: 1.0

Received: from server.######.com ([64.####.####.197]) by bay0-mc7-f11.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Sat, 11 Aug 2007 01:23:22 -0700

Received: from ###.#######.net ([209.###.###.34])by server.######.com with esmtpa (Exim 4.67 (FreeBSD))(envelope-from <REAL@DOMAIN.com>)id 1IJmEo-0007Md-BZfor r#######@hotmail.com; Sat, 11 Aug 2007 08:22:22 +0000

X-Message-Delivery: Vj0zLjQuMDt1cz##2k9MDtsPTA7YT0w

X-Message-Info: 6sSXyD95QpU8d/9lfRH5Aptnba##MGrqt1ZEPdUCYU6Hd+4ZLrT9PbaxeFYdmNvSRTFdXjLysBiPWr0S8uSg==

X-Mailer: PHPMailer [version 1.73]

X-AntiAbuse: This header was added to track abuse, please include it with any abuse report

X-AntiAbuse: Primary Hostname - #############.com

X-AntiAbuse: Original Domain - hotmail.com

X-AntiAbuse: Originator/Caller UID/GID - [26 6] / [26 6]

X-AntiAbuse: Sender Address Domain - #########.com

X-Source:

X-Source-Args:

X-Source-Dir:

Return-Path: webmaster@########.com

X-OriginalArrivalTime: 11 Aug 2007 08:23:22.0241 (UTC) FILETIME=[E154BF10:01C7DBF0]

 

 

i removed some details

Link to comment
https://forums.phpfreaks.com/topic/64634-submit-query/#findComment-322241
Share on other sites

You can not check whether or not an e-mail address exists without sending an e-mail to the e-mail address. All you can do is check the syntax / format of the e-mail address.

 

 

<?php

if(preg_match("/^([a-z0-9]+)([a-z0-9_-]*)([a-z0-9]+)@([a-z0-9]+)([a-z0-9-]*)([a-z0-9]+)\.([a-z]{1-3})/i")) {
    echo "Valid syntax";
}
else {
    echo "Invalid syntax";
}
?>

 

The above regex check whether or not the e-mail looks like email@address.com

 

 

*Maybe I have misunderstood what you are trying to do :)

 

Link to comment
https://forums.phpfreaks.com/topic/64634-submit-query/#findComment-322246
Share on other sites

that RegEx won't work

 

try

if (preg_match('/^\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b$/si', $email)) {
echo "valid";
}

 

 

 

or fix the Wuhtzus one

change

([a-z]{1-3})

to

([a-z]{1,3})

but the Wuhtzu's one will fail on a few

ie

metest@hotmail.coop

me.test@hotmail.com

or

metest@nothing.com hello

Link to comment
https://forums.phpfreaks.com/topic/64634-submit-query/#findComment-322251
Share on other sites

Sorry aobut the {1-3} it should of course be {1,3} but I do not agree with you on the e-mail addresses which will fail validation...

 

 

My regex, if there is no more mis-typings, will check that the e-mail's local part starts and ends with a-z or 0-9, in between it can hold _ and - which is not allowed to occur at the start or end according to the standards. After that it check for almost the same thing with the domain, that it stats and ends with a-z or 0-9 and may hold a - (minus) in between but again not start or end with - according to domain name standards.

 

Of course you could (and maybe should) allow more signs like . (dot) + (plus) and % to be in between the start and end of the local part.

 

And of course ([a-z]{1,3}) is the quick tld check - to be accurate you have to check against an array of all current tlds :)

Link to comment
https://forums.phpfreaks.com/topic/64634-submit-query/#findComment-322255
Share on other sites

but i could always enter bill.gates@microsoft.com thats a valid email but he may not of posted.. without sending an email and getting a reply i don't see how you can do this,

 

side note:

 

heres a nice email validator

<?php function isValidAddress( $email, $check = false )
{

  if (!ereg(''
      . '^'
      . '[-!#$%&\'*+/0-9=?A-Z^_a-z{|}~]'
      . '(\\.?[-!#$%&\'*+/0-9=?A-Z^_a-z{|}~])*'
      . '@'
      . '[a-zA-Z](-?[a-zA-Z0-9])*'
      . '(\\.[a-zA-Z](-?[a-zA-Z0-9])*)+'
      . '$'
      , $email
      )    ) return false;
  list( $local, $domain ) = split( "@", $email, 2 );
  if ( strlen($local) > 64 || strlen($domain) > 255 ) return false;
  if ( $check && !gethostbynamel( $domain ) ) return false;
  return true;

}
?>

 

@Wuhtzu, this is what you should use as will fail on a few check the examples i posted

"^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4})$";

Link to comment
https://forums.phpfreaks.com/topic/64634-submit-query/#findComment-322259
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.