dcsimg
Extracting the raw Email Address
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Yair_Grosu
Posted On:   Tuesday, July 16, 2002 08:51 AM



I am using message.getFrom() and receiveing the long

"john smith[jsmith@world.prg]" but I want to

get the jsmith@world.org only.



Is there an easy way to extract it from the getFrom

result - the Address?



Thank

Re: Extracting the raw Email Address

Posted By:   Christopher_Koenigsberg  
Posted On:   Tuesday, July 16, 2002 09:29 AM

More precise terminology would be, how to get the "rfc 821" address, out of the "rfc 822" address.



rfc 821, now superceded, was the original of the rfc's that defined the syntax of email addresses acceptable in actual SMTP MAIL FROM and RCPT TO fields, which is just the bare essential "localpart@domainpart".



rfc 822, also now superceded, was the original of the rfc's that define the more elaborate address strings for human consumption and for use in MUA's ("To:" and "From:" and "Reply-To:" address header lines) which include an 821 address at the core, plus possible elaborations with "comment strings" etc.)



If your message came from a mailing list, it could actually have 3 or more different return addresses. It could have one bare rfc 821 address in the SMTP MAIL FROM envelope (maybe the bounce-processing or list-request address), another, rfc 822 address in the "Reply-To:" header (maybe the list submission address), yet another rfc 822 address in the "From:" header (maybe the original person who submitted the message to the list).



In this case, which of these 3 addresses would you want? e.g. it would depend on your intention....



If you want to return a bounce or other error, you want the rfc 821 SMTP MAIL FROM envelope field.



If you want to do a "reply", you want the "Reply-To:" header if it is present. Otherwise if no "Reply-To" header is there, you want the "From:" header.

About | Sitemap | Contact