Re: [PHP] Parsing the From field

2011-11-20 Thread Geoff Shang

On Sat, 19 Nov 2011, Ron Piggott wrote:


Also the formatting of the from field changes in various e-mail programs:

From: Ron Piggott ron.pigg...@actsministries.org
From: Ron Piggott ron.pigg...@actsministries.org
From: ron.pigg...@actsministries.org
From: ron.pigg...@actsministries.org


I've also seen:

Piggott, Ron ron.pigg...@actsministries.org

And that's before you get to people who only use their first name and 
people who use some kind of alias.


I think you did well to abandon this.

Geoff.


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



[PHP] Parsing the From field

2011-11-19 Thread Ron Piggott

I am unsure of how to parse first name, last name and e-mail address from the 
'From:' field of an e-mail.

What I am struggling with is if the name has more than two words 
- Such as the last name being multiple words
- A name a business or department is given instead of a personal name
- If the person has included their middle name, middle initial or degrees 
(“Dr.”)
- If last name has multiple words

Also the formatting of the from field changes in various e-mail programs:

From: Ron Piggott ron.pigg...@actsministries.org
From: Ron Piggott ron.pigg...@actsministries.org
From: ron.pigg...@actsministries.org
From: ron.pigg...@actsministries.org

If there is more than 2 words for the name I would like them to be assigned to 
the last name.

Ron


Ron Piggott



www.TheVerseOfTheDay.info 


Re: [PHP] Parsing the From field

2011-11-19 Thread Alain Williams
On Sat, Nov 19, 2011 at 11:23:59AM -0500, Ron Piggott wrote:
 
 I am unsure of how to parse first name, last name and e-mail address from the 
 'From:' field of an e-mail.
 
 What I am struggling with is if the name has more than two words 
 - Such as the last name being multiple words
 - A name a business or department is given instead of a personal name
 - If the person has included their middle name, middle initial or degrees 
 (“Dr.”)
 - If last name has multiple words
 
 Also the formatting of the from field changes in various e-mail programs:
 
 From: Ron Piggott ron.pigg...@actsministries.org
 From: Ron Piggott ron.pigg...@actsministries.org
 From: ron.pigg...@actsministries.org
 From: ron.pigg...@actsministries.org
 
 If there is more than 2 words for the name I would like them to be assigned 
 to the last name.

You can make no such assumption, different people/companies/... do it in 
different ways.
If you really want to have fun look at the different 'norms' from different 
countries.

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT 
Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: 
http://www.phcomp.co.uk/contact.php
#include std_disclaimer.h

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



Re: [PHP] Parsing the From field

2011-11-19 Thread Ron Piggott


My web site is used by people from approximately of 90 countries.

- I will use just name instead of first name / last name.
- e-mail address




Ron Piggott



www.TheVerseOfTheDay.info

-Original Message- 
From: Alain Williams

Sent: Saturday, November 19, 2011 11:29 AM
To: Ron Piggott
Cc: php-general@lists.php.net
Subject: Re: [PHP] Parsing the From field

On Sat, Nov 19, 2011 at 11:23:59AM -0500, Ron Piggott wrote:


I am unsure of how to parse first name, last name and e-mail address from 
the 'From:' field of an e-mail.


What I am struggling with is if the name has more than two words
- Such as the last name being multiple words
- A name a business or department is given instead of a personal name
- If the person has included their middle name, middle initial or degrees 
(“Dr.”)

- If last name has multiple words

Also the formatting of the from field changes in various e-mail programs:

From: Ron Piggott ron.pigg...@actsministries.org
From: Ron Piggott ron.pigg...@actsministries.org
From: ron.pigg...@actsministries.org
From: ron.pigg...@actsministries.org

If there is more than 2 words for the name I would like them to be 
assigned to the last name.


You can make no such assumption, different people/companies/... do it in 
different ways.
If you really want to have fun look at the different 'norms' from different 
countries.


--
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT 
Lecturer.

+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: 
http://www.phcomp.co.uk/contact.php
#include std_disclaimer.h 



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



Re: [PHP] Parsing the From field

2011-11-19 Thread Al



On 11/19/2011 11:29 AM, Alain Williams wrote:

On Sat, Nov 19, 2011 at 11:23:59AM -0500, Ron Piggott wrote:


I am unsure of how to parse first name, last name and e-mail address from the 
'From:' field of an e-mail.

What I am struggling with is if the name has more than two words
- Such as the last name being multiple words
- A name a business or department is given instead of a personal name
- If the person has included their middle name, middle initial or degrees 
(“Dr.�)
- If last name has multiple words

Also the formatting of the from field changes in various e-mail programs:

From: Ron Piggottron.pigg...@actsministries.org
From: Ron Piggottron.pigg...@actsministries.org
From: ron.pigg...@actsministries.org
From:ron.pigg...@actsministries.org

If there is more than 2 words for the name I would like them to be assigned to 
the last name.


You can make no such assumption, different people/companies/... do it in 
different ways.
If you really want to have fun look at the different 'norms' from different 
countries.



Perhaps, Ron's email are constrained so there is a finite syntax. e.g., only to 
actsministries.org


Ron: I'd suggest your best approach is to use preg_match()
There are several examples on the net, try Google php preg_match email address



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