我有这个 PHP 代码/函数来发送电子邮件。
我需要添加什么代码来制作发送 HTML 而不是纯文本的电子邮件?
function sendemail($email_to,$email_from,$email_subject,$email_body,$email_replyto)
{
require_once "/usr/local/lib/php/Mail.php";
$from = $email_from;
$to = $email_to;
$subject = $email_subject;
$body = $email_body;
$host = "mail.integradigital.co.uk";
$username = "sending@integradigital.co.uk";
$password = "*********";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
}