[ PHPXref.com ] [ Generated: Sun Jul 20 21:17:54 2008 ] [ Zoph 0.5.1 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]




/php/ -> mimePart.php (summary)

(no description)

File Size: 351 lines (13 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Mail_mimePart:: (5 methods):

Class: Mail_mimePart  - X-Ref

Raw mime encoding class

What is it?
This class enables you to manipulate and build
a mime email from the ground up.

Why use this instead of mime.php?
mime.php 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.


// Since multipart/mixed has no real body, (the body is
// the subpart), we set the body argument to blank.

$params['content_type'] = 'multipart/mixed';
$email = new Mail_mimePart('', $params);

// Here we add a text part to the multipart we have
// already. Assume $body contains plain text.

$params['content_type'] = 'text/plain';
$params['encoding']     = '7bit';
$text = $email->addSubPart($body, $params);

// Now add an attachment. Assume $attach is
the contents of the attachment

$params['content_type'] = 'application/zip';
$params['encoding']     = 'base64';
$params['disposition']  = 'attachment';
$params['dfilename']    = 'example.zip';
$attach =& $email->addSubPart($body, $params);

// Now build the email. Note that the encode
// function returns an associative array containing two
// elements, body and headers. You will need to add extra
// headers, (eg. Mime-Version) before sending.

$email = $message->encode();
$email['headers'][] = 'Mime-Version: 1.0';

Further examples are available at http://www.phpguru.org

- Set encode() to return the $obj->encoded if encode()
has already been run. Unless a flag is passed to specifically
re-build the message.

Mail_mimePart($body = '', $params = array()   X-Ref

Sets up the object.

param: $body   - The body of the mime part if any.
param: $params - An associative array of parameters:

encode()   X-Ref

Encodes and returns the email. Also stores
it in the encoded member variable

return: An associative array containing two elements,

addSubPart($body, $params)   X-Ref

Adds a subpart to current mime part and returns
a reference to it

param: $body   The body of the subpart, if any.
param: $params The parameters for the subpart, same
return: A reference to the part you just added. It is

_getEncodedData($data, $encoding)   X-Ref

Returns encoded data based upon encoding passed to it

param: $data     The data to encode.
param: $encoding The encoding type to use, 7bit, base64,

_quotedPrintableEncode($input , $line_max = 76)   X-Ref

Encodes data to quoted-printable standard.

param: $input    The data to encode
param: $line_max Optional max line length. Should

[ Powered by PHPXref - Served by Debian GNU/Linux ]