You are here: Re: PHP and email addresses « PHP Programming Language « IT news, forums, messages
Re: PHP and email addresses

Posted by Tim Roberts on 06/12/06 07:33

Nick Bell <me@privacy.net> wrote:

>The expression:
>
>preg_match_all("/text.*?([A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6})/i",$f,
>$matches);
>
>Returns ONE email address on a line in $f beginning 'text' - how do I
>retrieve ALL the email addresses on a line in $f beginning 'text' in php?

This isn't foolproof by a long shot. Every printable character except [,
\, and ] is valid in an RFC2822 e-mail address, and even [ and ] can be
used if the address is wrapped in quotes.

The full regular expression required to match an RFC2822 compliant e-mail
address is more than 6,000 characters long, and is one of the gems in
Friedl's book "Mastering Regular Expressions".

It is common to use "*" in an e-mail address, for example. Sendmail has a
feature that uses it. If you send to "abc*def@joe.com", it will try find
an alias for "abc*def" exactly. Failing that, it will send the message to
"abc@joe.com". This is great for spam catching; I can sign up with web
sites as "timr*121@probo.com" without defining it, and if I get to much
spam, I just add a specific alias for that which routes to null.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация