Class Rfc822Header

Description

MIME header class input: header_string or array You must call parseHeader() function after creating object in order to fill object's parameters.

  • todo: FIXME: there is no constructor function and class should ignore all input args.
  • since: 1.3.0

Located in /class/mime/Rfc822Header.class.php (line 26)


	
			
Variable Summary
array $bcc
array $cc
mixed $date
mixed $disposition
mixed $dnt
mixed $encoding
array $from
string $in_reply_to
string $message_id
mixed $mime
mixed $mlist
integer $priority
array $raw_headers
string $references
array $reply_to
mixed $sender
string $subject
array $to
string $xmailer
Method Summary
object AddressStructure createAddressObject ( &$aStack,  &$aComment,  &$sEmail, [string $sGroup = ''], array $aStack, array $aComment, string $sEmail)
mixed findAddress (mixed $address, [boolean $use_from = FALSE], [boolean $recurs = FALSE])
array getAddressTokens (string $address)
array getAddr_a (mixed $arg, [array $excl_arr = array()], [array $arr = array()])
string getAddr_s (mixed $arr, [string $separator = ','], [boolean $encoded = false], [boolean $unconditionally_quote = FALSE])
array getContentType (string $type0, string $type1)
void mlist (string $field, string $value)
mixed parseAddress (string $address, [boolean $ar = false], [ $aAddress = array()], [ $sGroup = ''], [ $sHost = ''], [string $lookup = false], array $addr_ar, string $group, string $host)
void parseContentType (string $value)
void parseDisposition (string $value)
void parseField (string $field, string $value)
void parseHeader (mixed $hdr)
integer parsePriority (string $sValue)
array parseProperties (string $value)
void parseSpamStatus (string $value)
array processParameters (array $aParameters)
string stripComments (string $value)
Variables
array $bcc = array() (line 80)

Bcc header

array $cc = array() (line 75)

Cc header

mixed $content_type = '' (line 103)
mixed $date = -1 (line 36)

Date header

mixed $date_unparsed = '' (line 41)

Original date header as fallback for unparsable dates

mixed $disposition = '' (line 107)
mixed $dnt = '' (line 121)
mixed $encoding = '' (line 125)
array $from = array() (line 51)

From header

string $in_reply_to = '' (line 85)

In-reply-to header

array $mail_followup_to = array() (line 65)

Mail-Followup-To header

string $message_id = '' (line 90)

Message-ID header

mixed $mime = false (line 99)
mixed $mlist = array() (line 129)
array $more_headers = array() (line 140)

Extra header

only needed for constructing headers in delivery class

integer $priority = 3 (line 117)

Priority header

array $raw_headers = array() (line 31)

All headers, unparsed

string $references = '' (line 95)

References header

array $reply_to = array() (line 60)

Reply-To header

mixed $sender = '' (line 55)
string $subject = '' (line 46)

Subject header

array $to = array() (line 70)

To header

string $xmailer = '' (line 112)

X-Mailer header

mixed $x_spam_status = array() (line 134)

SpamAssassin 'x-spam-status' header

Methods
createAddressObject (line 476)
  • return: object
object AddressStructure createAddressObject ( &$aStack,  &$aComment,  &$sEmail, [string $sGroup = ''], array $aStack, array $aComment, string $sEmail)
  • array $aStack
  • array $aComment
  • string $sEmail
  • string $sGroup
  • &$aStack
  • &$aComment
  • &$sEmail
findAddress (line 998)

Looking at the code years after it was written,

this is my (Paul) best guess as to what this function does (note that docs previously claimed that this function returns boolean or an array, but it no longer appears to return an array - an integer instead):

Inspects the TO and CC (or FROM) headers of the message represented by this object, looking for the address(es) given by $address

If $address is a string: Serves as a test (returns boolean) as to whether or not the given address is found anywhere in the TO or CC (or FROM) headers

If $address is an array: Looks through this list of addresses and returns the array index (an integer even if the array is given with keys of a different type) of the first matching $address found in this message's TO or CC (or FROM) headers, unless there is an exact match (meaning that the "personal information" in addition to the email address also matches), in which case that index (the first one found) is returned

  • return: Boolean when $address is a scalar, indicating whether or not the address was found in the TO or CC headers. An integer when $address is an array, containing the index of the value in that array that was found in the TO or CC headers, or boolean FALSE if there were no matches at all
  • since: 1.3.2
mixed findAddress (mixed $address, [boolean $use_from = FALSE], [boolean $recurs = FALSE])
  • mixed $address: Address(es) to search for in this message's TO and CC (or FROM) headers - please see above how the format of this argument affects the return value of this function
  • boolean $use_from: When TRUE, this function will ONLY search the FROM headers and NOT the TO and CC headers, when FALSE, ONLY the TO and CC headers are searched (OPTIONAL; default is FALSE)
  • boolean $recurs: FOR INTERNAL USE ONLY
getAddressTokens (line 344)
array getAddressTokens (string $address)
  • string $address
getAddr_a (line 910)

function to get the array of addresses out of the header.

array getAddr_a (mixed $arg, [array $excl_arr = array()], [array $arr = array()])
  • mixed $arg: string or array of strings
  • array $excl_arr: array of excluded email addresses
  • array $arr: array of added email addresses
getAddr_s (line 867)

function to get the address strings out of the header.

example1: header->getAddr_s('to'). example2: header->getAddr_s(array('to', 'cc', 'bcc'))

string getAddr_s (mixed $arr, [string $separator = ','], [boolean $encoded = false], [boolean $unconditionally_quote = FALSE])
  • mixed $arr: string or array of strings
  • string $separator
  • boolean $encoded: (since 1.4.0) return encoded or plain text addresses
  • boolean $unconditionally_quote: (since 1.4.21/1.5.2) When TRUE, always quote the personal part, whether or not it is encoded, otherwise quoting is only added if the personal part is not encoded
getContentType (line 1082)
  • return: media properties
  • todo: check use of media type arguments
array getContentType (string $type0, string $type1)
  • string $type0: media type
  • string $type1: media subtype
mlist (line 773)

Fills mlist array keys in rfc822Header object

void mlist (string $field, string $value)
  • string $field
  • string $value
parseAddress (line 529)

recursive function for parsing address strings and storing them in an address stucture object.

personal name: encoded: =?charset?Q|B?string?= quoted: "string" normal: string email : <mailbox@host> : mailbox@host This function is also used for validating addresses returned from compose That's also the reason that the function became a little bit huge

  • return: array with AddressStructure objects or only one address_structure object.
mixed parseAddress (string $address, [boolean $ar = false], [ $aAddress = array()], [ $sGroup = ''], [ $sHost = ''], [string $lookup = false], array $addr_ar, string $group, string $host)
  • string $address
  • boolean $ar: return array instead of only the first element
  • array $addr_ar: (obsolete) array with parsed addresses
  • string $group: (obsolete)
  • string $host: default domainname in case of addresses without a domainname
  • string $lookup: (since) callback function for lookup of address strings which are probably nicks (without @)
  • $aAddress
  • $sGroup
  • $sHost
parseContentType (line 665)
void parseContentType (string $value)
  • string $value: content type header
parseDisposition (line 753)

Fills disposition object in rfc822Header object

void parseDisposition (string $value)
  • string $value
parseField (line 223)

Parse header field according to field type

void parseField (string $field, string $value)
  • string $field: field name
  • string $value: field value
parseHeader (line 145)
void parseHeader (mixed $hdr)
  • mixed $hdr: string or array with message headers
parsePriority (line 645)

Normalise the different Priority headers into a uniform value, namely that of the X-Priority header (1, 3, 5). Supports: Priority, X-Priority, Importance.

X-MS-Mail-Priority is not parsed because it always coincides with one of the other headers.

NOTE: this is actually a duplicate from the function in functions/imap_messages. I'm not sure if it's ok here to call that function?

integer parsePriority (string $sValue)
  • string $sValue: literal priority name
parseProperties (line 731)
array parseProperties (string $value)
  • string $value
parseSpamStatus (line 794)

Parses the X-Spam-Status or X-Spam-Score header

void parseSpamStatus (string $value)
  • string $value
processParameters (line 690)

RFC2184

array processParameters (array $aParameters)
  • array $aParameters
stripComments (line 176)
string stripComments (string $value)
  • string $value

Documentation generated on Mon, 13 Jan 2020 04:25:14 +0100 by phpDocumentor 1.4.3