PEAR Handbuch | ||
---|---|---|
Zurück | Nach vorne |
Mail_mimePart enables you to manipulate and build a MIME email from the grund up. This class contains no default values or high level API functions, but you get a control about the internals of a MIME mail. Don't use this class if you are not experienced with the format and/or creating multipart MIME messages. You should take a look on Mail_mime , to check if this class already fits your needs.
string $body - The body of the mime part if any. Default is an empty string.
array $params - An associative array of parameters:
$params["content_type"] - The content type for this part ie. multipart/mixed
$params["encoding"] - The encoding to use ie. 7bit, 8bit, base64 or quoted-printable
$params["cid"] - content ID to apply
$params["disposition"] - Content disposition inline or attachment
$params["dfilename"] - Optional filename parameter for content disposition
$params["description"] - Content description
$params["charset"] - Character set to use
string - The body of the subpart
array - The parameter for the subpart. See the constructor for the possible values.
<?php include 'Mail/mimePart.php'; ... $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'; ... ?> |
Zurück | Zum Anfang | Nach vorne |
Mail_mime | Nach oben | Mail_mimeDecode |