Location: PHPKode > projects > EXtensible Production Suite (XPS) > xpsdev/helpers/xpm3/DOCUMENTATION/mime/compose.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>XPM3_MIME::compose()</title>
<style>
body, pre {
	font-family: Verdana;
	font-size: 10pt;
}
</style>
</head>
<body bgcolor="#f1f3f5" topmargin="10" leftmargin="14">

<pre>
XPM3_MIME :: <i>array</i> <b>compose</b> ( [ <i>mixed</i> text [, <i>mixed</i> html [, <i>mixed</i> attachment [, <i>mixed</i> unique ]]]] )
<hr>
Returns an array with two values "addheader" and "body".

addheader - add this value in mail header.
body - mail body value.

Default values are:
<i>mixed</i> text: <i>boolean</i> false
<i>mixed</i> html: <i>boolean</i> false
<i>mixed</i> attachment: <i>boolean</i> false
<i>mixed</i> unique: NULL

Example:
<table border="0" bgcolor="white">
<tr><td>
<pre><code>
$text = array('header'  => 'Content-Type: text/plain'."\r\n".
                           'Content-Disposition: inline', 
              'content' => 'Text message');

$html = array('header'  => 'Content-Type: text/html'."\r\n".
                           'Content-Disposition: inline', 
              'content' => 'HTML message');

$attach[] = array('disposition' => 'attachment', 
                  'header'      => 'Content-Type: text/plain'."\r\n".
                                   'Content-Disposition: attachment', 
                  'content'     => 'Text file for attachment');

$result = XPM3_MIME::compose($text, $html, $attach);

// print result
print_r($result);

/* will print:
Array
(
    [addheader] => MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary="=_bcd0cbaff07bace951486bfe2e862f77"
    [body] => This is a message in MIME Format. If you see this, your mail reader does not support this format.

--=_bcd0cbaff07bace951486bfe2e862f77
Content-Type: multipart/alternative;
	boundary="=_25fed5e6fae2dd3f1c90e046dbe10465"

--=_25fed5e6fae2dd3f1c90e046dbe10465
Content-Type: text/plain
Content-Disposition: inline

Text message
--=_25fed5e6fae2dd3f1c90e046dbe10465
Content-Type: text/html
Content-Disposition: inline

HTML message
--=_25fed5e6fae2dd3f1c90e046dbe10465--
--=_bcd0cbaff07bace951486bfe2e862f77
Content-Type: text/plain
Content-Disposition: attachment

Text file for attachment
--=_bcd0cbaff07bace951486bfe2e862f77--
)
*/
</code></pre>
</td></tr>
</table>

<hr color="white">

[ <a style="color: blue; text-decoration: none" href="mailto:hide@address.com?subject=Comment XPM3_MIME compose">Comments</a> ]

Last update: Tuesday, January 16, 2007

</pre>

</body>
</html>
Return current item: EXtensible Production Suite (XPS)