New Mail/Mime.php class

From: Date: Tue, 26 Jun 2001 10:36:09 +0000
Subject: New Mail/Mime.php class
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-491@lists.php.net to get a copy of this message
Hi, I've made an adaptation of the Richard Heyes HTML Mime Mail class. This class manages all the things related to compose mime mails (html email, html email with embedded images, attachments, etc). I've changed some things and integrated into Pear. My main focus on building this class is to improve the original usability. As I haven't yet defined the final API, perhaps someone can give me some ideas. I though on that as usage method: require 'Mail/Mime.php'; $mime = new Mail_Mime; // Set a text body. If HTML body is present, it will be // used as alternative content (the content that email clients who // don't support html should display) // function addTxtBody($string, $isfile) // @param $string string either a text or a filename // @param $isfile bool if the first param is a file or not $mime->setTxtBody($string); $mime->setTxtBody($file_name, TRUE); // Set the HTML body. $mime->setHTMLBody($string); $mime->setHTMLBody($file_name, TRUE); // Add an embedded image for html bodies $mime->addHTMLImage($file_name, $content_type); $mime->addAttachment($file_name, $content_type); // builds the mime mail and returns it back as string $mail_contents = $mime->get(); Then the only thing you need to do is choose your prefered transport method (already implemented mail, sendmail and smtp). For ex: Mail_Sendmail::send($recipients, $headers, $mime->get()); If noone suggests changes/missing points, I'll commit so. IMHO in Pear we can't have a complete Mail folder without a mime mail manager. Also if somebody can point me to some good code that do the reverse action (get the files back from a mime mail) I'll be very glad. Tomas V.V.Cox

« previous php.pear.dev (#491) next »