RFC822 Address Parser Library 1.0 review
DownloadRFC822 Address Parser Library provides application developers with a complete parser for RFC822 addresses
|
|
RFC822 Address Parser Library provides application developers with a complete parser for RFC822 addresses. Not only can you use the library to verify that RFC822 addresses are syntactically correct, you can also have an address split up into its semantic parts, what is needed when deciding where to route an address to, etc.
What is quite unique is that librfc822 does indeed parse all address types allowed by the standard. That includes such weird things as "address groups" or addresses with whitespace and comments throw in. Take a look at this beast to get an idea:
testing my parser : peter.simons@gmd.de,
(peter.)simons@rhein.de ,,,,,
testing my parser ,
it rules < @peti.gmd.de,@listserv.gmd.de:simons @ cys .de >
;
,
peter.simons@acm.org
That is indeed a legal e-mail address in RFC822 messages. It contains five separate addresses, which are grouped together. Here's the parsed result:
peter.simons@gmd.de
simons@rhein.de
simons@ieee.org
< @peti.gmd.de,@listserv.gmd.de:simons@cys.de >
peter.simons@acm.org
simons@rhein.de
simons@rhein.de
simons@rhein.de
In case you wonder: The strange looking address that's listed fourth is a so called "routing address" -- and yes, that's a legal e-mail address, too. These were popular in the early days of the Internet. Back then, every mail server that relayed an e-mail put its own address into this construct so that bounces could be routed the same way back that they originally went.
The address says that the mail should be send to the host peti.gmd.de, then to listserv.gmd.de, and from there it should be delivered (using any route) to the address simons@cys.de. These days, such addresses can hardly be used, because nobody relays for other recipients anymore. Still, these are legal.
librfc822 provides you with several routines that parse the different flavours of e-mail addresses as defined in the standard. The results will be placed in a rfc822address structure and returned. If constructs are parsed that may contain multiple addresses, you can pass a "committer" class to the function, which is called every time a correct address is found and may append it to a container of your choice.
RFC822 Address Parser Library 1.0 search tags