Peeker Parts


Parts Class

This class handles the email Parts data.

Important:  All of these functions are available through the message object returned by the Peeker class. Notated here as: $e

Function Reference

parts()

Get the email and extract and decode all the parts into a nice array property parts_array. Calls body class body() function which calls the extract_parts() function. Note: you must call this ( or body() ) before any detectors will work.

$e->parts();

get_parts_count()

Returns the count of parts found - not including meta parts like nodes - just real parts.

$e->get_parts_count();

get_parts_array()

Returns the array of parts built by the parts() function.

$e->get_parts_array();

Detectors - All Return TRUE or FALSE

has_attachment()

TRUE if the message has an attachment.

$e->has_attachment();

has_at_least_one_attachment_with_disposition($disp)

TRUE if the message has an attachment with specified disposition. Disposition can be inline or attachment. This is for detecting if an image has been attached to the message and it expects the client to render it inline without calling out to a webserver to get it.

$e->has_at_least_one_attachment_with_disposition();

has_at_least_one_attachment($subtype)

TRUE if any attachment is of the specified subtype (e.g., jpg, pdf, xls, etc...). Function expects the 3-letter version of the file type.

$e->has_at_least_one_attachment('jpg'); // detector for moblog

Callbacks

insert_HTML($str)

Brute force. Looks for marker in HTML and inserts the string so it appears inside the html just before the closing body tags.

$e->insert_HTML('<br />This email is confidential');

insert_PLAIN($str)

Appends string to the end of the PLAIN text.

$e->insert_PLAIN("--\nThis is my signature");

rewrite_html_transform_img_tags($base_url='')

Attempts to change the HTML that points to local resources (cid: style img tags) so that the HTML points to remote resources instead. Pass the base_url where the images will be. If it is not passed, the img tags will be re-written as relative paths.

$e->rewrite_html_transform_img_tags();

render_first_jpeg()

Testing. Show the first jpeg attached to the email. Renders it to the browser (sends jpeg header) so it will not work if other data has already been sent.

$e->render_first_jpeg();

save_header_string($file_name='header_string.txt')

Save the header string somewhere as a file.

$e->save_header_string();

save_body_string($file_name='body_string.txt')

Save the raw, undecoded body string somewhere as a file.

$e->save_body_string();

save_PLAIN($file_name='PLAIN.txt')

Save the PLAIN string somewhere as a text file.

$e->save_PLAIN();

save_HTML($file_name='HTML.html')

Save the HTML string somewhere as an HTML file.

$e->save_HTML();

save_all_attachments($dir=NULL)

Dumps all the attachments to the filesystem.

$e->save_all_attachments();

get_file_name_array()

Returns the array containing all the filenames of the attached files.

$e->get_file_name_array();