getFile('background.gif'); /* * Read the file test.zip into $attachment. */ $attachment = $mail->getFile('example.zip'); /* * Get the contents of the example text/html files. * Text/html data doesn't have to come from files, * could come from anywhere. */ $text = $mail->getFile('example.txt'); $html = $mail->getFile('example.html'); /* * Add the text, html and embedded images. * The name (background.gif in this case) * of the image should match exactly * (case-sensitive) to the name in the html. */ $mail->setHtml($html, $text); $mail->addHtmlImage($background, 'background.gif', 'image/gif'); /* * This is used to add an attachment to * the email. Due to above, the $attachment * variable contains the example zip file. */ $mail->addAttachment($attachment, 'example.zip', 'application/zip'); /* * Set the return path of the message */ $mail->setReturnPath('joe@example.com'); /** * Set some headers */ $mail->setFrom('"Joe" '); $mail->setSubject('Test mail'); $mail->setHeader('X-Mailer', 'HTML Mime mail class (http://www.phpguru.org)'); /** * Send it using SMTP. If you're using Windows you should *always* use * the smtp method of sending, as the mail() function is buggy. */ $result = $mail->send(array('postmaster@localhost'), 'smtp'); // These errors are only set if you're using SMTP to send the message if (!$result) { print_r($mail->errors); } else { echo 'Mail sent!'; } ?>