Mail_Mime
[ class tree: Mail_Mime ] [ index: Mail_Mime ] [ all elements ]

Class: Mail_mimePart

Source Location: /Mail_Mime-1.9.0/Mail/mimePart.php

Class Overview


The Mail_mimePart class is used to create MIME E-mail messages


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2003-2006 PEAR <pear-group@php.net>

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 82]
The Mail_mimePart class is used to create MIME E-mail messages

This class enables you to manipulate and build a mime email from the ground up. The Mail_Mime class is a userfriendly api to this class for people who aren't interested in the internals of mime mail. This class however allows full control over the email.



[ Top ]


Class Variables

$body =

[line 117]

The body of this part (not encoded)
  • Access: protected

Type:   string


[ Top ]

$body_file =

[line 124]

The location of file with body of this part (not encoded)
  • Access: protected

Type:   string


[ Top ]

$encoded =

[line 103]

The output of this part after being built
  • Access: protected

Type:   string


[ Top ]

$encoding =

[line 89]

The encoding type of this part
  • Access: protected

Type:   string


[ Top ]

$eol =  "\r\n"

[line 131]

The end-of-line sequence
  • Access: protected

Type:   string


[ Top ]

$headers =

[line 110]

Headers for this part
  • Access: protected

Type:   array


[ Top ]

$subparts =

[line 96]

An array of subparts
  • Access: protected

Type:   array


[ Top ]



Method Detail

__construct (Constructor)   [line 162]

Mail_mimePart __construct( [string $body = ''], [array $params = array()])

Constructor.

Sets up the object.

  • Access: public

Parameters:

string   $body   —  The body of the mime part if any.
array   $params   —  An associative array of optional parameters: content_type - The content type for this part eg multipart/mixed encoding - The encoding to use, 7bit, 8bit, base64, or quoted-printable charset - Content character set cid - Content ID to apply disposition - Content disposition, inline or attachment filename - Filename parameter for content disposition description - Content description name_encoding - Encoding of the attachment name (Content-Type) By default filenames are encoded using RFC2231 Here you can set RFC2047 encoding (quoted-printable or base64) instead filename_encoding - Encoding of the attachment filename (Content-Disposition) See 'name_encoding' headers_charset - Charset of the headers e.g. filename, description. If not set, 'charset' will be used eol - End of line sequence. Default: "\r\n" headers - Hash array with additional part headers. Array keys can be in form of <header_name>:<parameter_name> body_file - Location of file with part's body (instead of $body)

[ Top ]

addSubpart   [line 462]

Mail_mimePart addSubpart( string $body, array $params)

Adds a subpart to current mime part and returns a reference to it
  • Return: A reference to the part you just added.
  • Access: public

Parameters:

string   $body   —  The body of the subpart, if any.
array   $params   —  The parameters for the subpart, same as the $params argument for constructor.

[ Top ]

buildHeaderParam   [line 657]

string buildHeaderParam( string $name, string $value, [string $charset = null], [string $language = null], [string $encoding = null], [int $maxLength = 75])

Encodes the parameter of a header.
  • Access: protected

Parameters:

string   $name   —  The name of the header-parameter
string   $value   —  The value of the paramter
string   $charset   —  The characterset of $value
string   $language   —  The language used in $value
string   $encoding   —  Parameter encoding. If not set, parameter value is encoded according to RFC2231
int   $maxLength   —  The maximum length of a line. Defauls to 75

[ Top ]

buildRFC2047Param   [line 730]

string buildRFC2047Param( string $name, string $value, string $charset, [string $encoding = 'quoted-printable'], [int $maxLength = 76])

Encodes header parameter as per RFC2047 if needed
  • Return: Parameter line
  • Access: protected

Parameters:

string   $name   —  The parameter name
string   $value   —  The parameter value
string   $charset   —  The parameter charset
string   $encoding   —  Encoding type (quoted-printable or base64)
int   $maxLength   —  Encoded parameter max length. Default: 76

[ Top ]

encode   [line 299]

An encode( [string $boundary = null])

Encodes and returns the email. Also stores it in the encoded member variable
  • Return: associative array containing two elements, body and headers. The headers element is itself an indexed array. On error returns PEAR error object.
  • Access: public

Parameters:

string   $boundary   —  Pre-defined boundary string

[ Top ]

encodeHeader   [line 800]

string encodeHeader( string $name, string $value, [string $charset = 'ISO-8859-1'], [string $encoding = 'quoted-printable'], [string $eol = "\r\n"])

Encodes a header as per RFC2047
  • Return: Encoded header data (without a name)
  • Since: 1.6.1
  • Access: public

Parameters:

string   $name   —  The header name
string   $value   —  The header data to encode
string   $charset   —  Character set name
string   $encoding   —  Encoding name (base64 or quoted-printable)
string   $eol   —  End-of-line sequence. Default: "\r\n"

[ Top ]

encodeHeaderValue   [line 969]

string encodeHeaderValue( string $value, string $charset, string $encoding, [int $prefix_len = 0], [string $eol = "\r\n"])

Encodes a header value as per RFC2047
  • Return: Encoded header data
  • Since: 1.6.1
  • Access: public

Parameters:

string   $value   —  The header data to encode
string   $charset   —  Character set name
string   $encoding   —  Encoding name (base64 or quoted-printable)
int   $prefix_len   —  Prefix length. Default: 0
string   $eol   —  End-of-line sequence. Default: "\r\n"

[ Top ]

encodeMB   [line 1097]

string encodeMB( string $str, string $charset, string $encoding, [int $prefix_len = 0], [string $eol = "\r\n"])

Encodes the given string using base64 or quoted-printable.

This method makes sure that encoded-word represents an integral number of characters as per RFC2047.

  • Return: Encoded string
  • Since: 1.8.0
  • Access: public

Parameters:

string   $str   —  String to encode
string   $charset   —  Character set name
string   $encoding   —  Encoding name (base64 or quoted-printable)
int   $prefix_len   —  Prefix length. Default: 0
string   $eol   —  End-of-line sequence. Default: "\r\n"

[ Top ]

encodePartToFile   [line 407]

array encodePartToFile( string $fh, [string $boundary = null], [boolean $skip_head = false])

Encodes given email part into file
  • Return: True on sucess or PEAR error object
  • Access: protected

Parameters:

string   $fh   —  Output file handle
string   $boundary   —  Pre-defined boundary string
boolean   $skip_head   —  True if you don't want to save headers

[ Top ]

encodeQP   [line 1068]

string encodeQP( string $str)

Encodes the given string using quoted-printable
  • Return: Encoded string
  • Since: 1.6.0
  • Access: public

Parameters:

string   $str   —  String to encode

[ Top ]

encodeReplaceCallback   [line 1207]

string encodeReplaceCallback( array $matches)

Callback function to replace extended characters (\x80-xFF) with their ASCII values (RFC2231)
  • Return: Encoded character string
  • Access: protected

Parameters:

array   $matches   —  Preg_replace's matches array

[ Top ]

encodeToFile   [line 364]

array encodeToFile( mixed $filename, [string $boundary = null], [boolean $skip_head = false])

Encodes and saves the email into file or stream.

Data will be appended to the file/stream.

  • Return: An associative array containing message headers or PEAR error object
  • Since: 1.6.0
  • Access: public

Parameters:

mixed   $filename   —  Existing file location or file pointer resource
string   $boundary   —  Pre-defined boundary string
boolean   $skip_head   —  True if you don't want to save headers

[ Top ]

explodeQuotedString   [line 937]

array explodeQuotedString( string $delimiter, string $string)

Explode quoted string
  • Return: String tokens array
  • Access: protected

Parameters:

string   $delimiter   —  Delimiter expression string for preg_match()
string   $string   —  Input string

[ Top ]

getEncodedData   [line 478]

string getEncodedData( string $data, string $encoding)

Returns encoded data based upon encoding passed to it
  • Return: Encoded data string
  • Access: protected

Parameters:

string   $data   —  The data to encode.
string   $encoding   —  The encoding type to use, 7bit, base64, or quoted-printable.

[ Top ]

getEncodedDataFromFile   [line 507]

string getEncodedDataFromFile( string $filename, string $encoding, [resource $fh = null])

Returns encoded data based upon encoding passed to it
  • Return: Encoded data or PEAR error object
  • Access: protected

Parameters:

string   $filename   —  Data file location
string   $encoding   —  The encoding type to use, 7bit, base64, or quoted-printable.
resource   $fh   —  Output file handle. If set, data will be stored into it instead of returning it

[ Top ]

qpReplaceCallback   [line 1194]

string qpReplaceCallback( array $matches)

Callback function to replace extended characters (\x80-xFF) with their ASCII values (RFC2047: quoted-printable)
  • Return: Encoded character string
  • Access: protected

Parameters:

array   $matches   —  Preg_replace's matches array

[ Top ]

quotedPrintableEncode   [line 583]

string quotedPrintableEncode( string $input, [int $line_max = 76], [string $eol = "\r\n"])

Encodes data to quoted-printable standard.
  • Return: Encoded data
  • Access: public

Parameters:

string   $input   —  The data to encode
int   $line_max   —  Optional max line length. Should not be more than 76 chars
string   $eol   —  End-of-line sequence. Default: "\r\n"

[ Top ]

raiseError   [line 1219]

PEAR_Error raiseError( string $message)

PEAR::raiseError implementation
  • Return: Instance of PEAR_Error
  • Access: public

Parameters:

string   $message   —  A text error message

[ Top ]


Documentation generated on Thu, 06 Aug 2015 08:00:03 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.