getFile('background.gif'); /** * If sending an html email, then these * two variables specify the text and * html versions of the mail. Don't * have to be named as these are. Just * make sure the names tie in to the * $mail->setHtml() call further down. */ $text = $mail->getFile('example.txt'); $html = $mail->getFile('example.html'); /** * Add the text, html and embedded images. * Here we're using the third argument of * setHtml(), which is the path to the * directory that holds the images. By * adding this third argument, the class * will try to find all the images in the * html, and auto load them in. Not 100% * accurate, and you MUST enclose your * image references in quotes, so src="img.jpg" * and NOT src=img.jpg. Also, where possible, * duplicates will be avoided. */ $mail->setHtml($html, $text, './'); /** * Sends the message. */ $mail->setFrom('Joe '); $mail->setSubject('Test mail'); $result = $mail->send(array('postmaster@localhost')); echo $result ? 'Mail sent!' : 'Failed to send mail'; ?>