Re: Checking for a Valid Email String.
| From: | Paul Chvostek | Date: | Wed, 12 Mar 2003 03:30:52 +0000 |
| Subject: | Re: Checking for a Valid Email String. | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139215@lists.php.net to get a copy of this message | ||
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 <paul@it.ca>
Operations / Abuse / Whatever
it.canada, hosting and development http://www.it.ca/