require 'Mail.php';
require 'Mail/mime.php';
$to = 'adam@example.com, sklar@example.com';
$headers['From'] = 'webmaster@example.com';
$headers['Subject'] = 'New Version of PHP Released!';
// create MIME object
$mime = new Mail_mime;
// add body parts
$text = 'Text version of email';
$mime->setTXTBody($text);
$html = '<html><body>HTML version of email</body></html>';
$mime->setHTMLBody($html);
$file = '/path/to/file.png';
$mime->addAttachment($file, 'image/png');
// get MIME formatted message headers and body
$headers = $mime->headers($headers);
$body = $mime->get();
$message =& Mail::factory('mail');
$message->send($to, $headers, $body);