tags:

views:

119

answers:

1

I am sending out an email, and the message ($message) is in HTML

I used a different script before (HTML MIME MAIL) and I just set it to HTML by doing this: setHTML($message).

With this script, I am unsure how I would set $message to output as HTML within the email.

require_once "Mail.php";

$from = "[email protected]";
$host = "mail.domain.com";
$username = "username";
$password = "password";

$headers = array ('From' => $from,
'To' => $emailto,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));

$mail = $smtp->send($emailto, $headers, $message);

if (PEAR::isError($mail)) {
    echo("<p>" . $mail->getMessage() . "</p>");
} else {
    echo("<p>Message successfully sent!</p>");
}
+1  A: 

Your missing the headers that say it's html, try this instead:

$headers = array ('From' => $from,
'To' => $emailto,
'Subject' => $subject,
'MIME-Version' => '1.0',
'Content-type' => 'text/html; charset=iso-8859-1');
savageguy
Perfect, thanks!
Brad