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 $content_id
object $content_type
mixed $date
mixed $disposition
mixed $dnt
mixed $drnt
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 $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_desc = '' (line 140)
mixed $content_id = '' (line 136)
object $content_type = '' (line 104)

Content Type object

mixed $date = -1 (line 36)

Date header

mixed $date_unparsed = '' (line 41)

Original date header as fallback for unparsable dates

mixed $disposition = '' (line 108)
mixed $dnt = '' (line 123)

Disposition notification for requesting message delivery notification (MDN)

mixed $drnt = '' (line 128)

Delivery notification (DR)

mixed $encoding = '' (line 132)
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 144)
array $more_headers = array() (line 155)

Extra header

only needed for constructing headers in delivery class

integer $priority = 3 (line 118)

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 113)

X-Mailer header

mixed $x_spam_status = array() (line 149)

SpamAssassin 'x-spam-status' header

Methods
createAddressObject (line 506)
  • 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 1024)

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 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 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 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 $recurs = false])
  • mixed $address: Address(es) to search for in this message's TO and CC headers - please see above how the format of this argument affects the return value of this function
  • boolean $recurs: FOR INTERNAL USE ONLY
getAddressTokens (line 374)
array getAddressTokens (string $address)
  • string $address
getAddr_a (line 941)

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 898)

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 1090)
  • 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 804)

Fills mlist array keys in rfc822Header object

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

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 696)
void parseContentType (string $value)
  • string $value: content type header
parseDisposition (line 784)

Fills disposition object in rfc822Header object

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

Parse header field according to field type

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

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 code in functions/imap_messages:parseFetch(). I'm not sure if it's ok here to call that function?

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

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

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

RFC2184

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

Documentation generated on Mon, 13 Jan 2020 04:23:28 +0100 by phpDocumentor 1.4.3