Version: @(#) $Id: rfc822_addresses.php,v 1.6 2008/01/05 06:36:08 mlemos Exp $
RFC 822 e-mail addresses parser
Manuel Lemos (mlemos-at-acm.org)
Copyright © (C) Manuel Lemos 2006 - 2008
@(#) $Id: rfc822_addresses.php,v 1.6 2008/01/05 06:36:08 mlemos Exp $
Parse e-mail addresses from headers of RFC 822 compliant e-mail messages.
Use the function ParseAddressList function to retrieve the list of e-mail addresses contained in e-mail message headers like From, To, Cc or Bcc.
Store the message that is returned when an error occurs.
Check this variable to understand what happened when a call to any of the class functions has failed.
This class uses cumulative error handling. This means that if one class functions that may fail is called and this variable was already set to an error message due to a failure in a previous call to the same or other function, the function will also fail and does not do anything.
This allows programs using this class to safely call several functions that may fail and only check the failure condition after the last function call.
Just set this variable to an empty string to clear the error condition.
Point to the position of the message data or file that refers to the last error that occurred.
Check this variable to determine the relevant position of the message when a parsing error occurs.
Specify whether the class should ignore syntax errors in malformed addresses.
Set this variable to 0 if it is necessary to verify whether message data may be corrupted due to to eventual bugs in the program that generated the message.
Currently the class only ignores some types of syntax errors. Other syntax errors may still cause the ParseAddressList to fail.
Return a list of positions of the original message that contain syntax errors.
Check this variable to retrieve eventual message syntax errors that were ignored when the ignore_syntax_errors is set to 1.
The indexes of this array are the positions of the errors. The array values are the corresponding syntax error messages.
Parse and extract e-mail addresses eventually from headers of an e-mail message.
Pass a string value with a list of e-mail addresses to the value. The addresses returns the list of e-mail addresses found.
value - String with a list of e-mail addresses to parse.
addresses - Return the list of parsed e-mail addresses. Each entry in the list is an associative array.
For normal addresses, this associative array has the entry 'address' set to the e-mail address. If the address has an associated name, it is stored in the entry 'name'.
For address groups, there is the entry 'name'. The group addresses list are stored in the entry 'group' as an array. The structure of the group addresses list array is the same as this addresses list array argument.
This function returns 1 if the specified value is parsed successfully. Otherwise, check the variables error and error_position to determine what error occurred and the relevant value position.