通过PEAR发送php smtp邮件时出现html内容类型标题问题

时间:2012-06-01 00:04:17

标签: php email smtp pear

我可以完美地发送电子邮件但是它们显示在纯文本上,我一直在尝试很多解决方案来将其显示为HTML尝试放置内容类型但是当我检查来自电子邮件的标题时发送的MIME和Content-type标头丢失了。我做错了什么?

谢谢!

$email = "example@test.com";

$subject = "example subject\r\n";

$msg_body = "example body with some html";

$host = "mail.examplehost.com";
     $username = "exampleemail@test.com";
     $password = "examplepass";

$smtp = Mail::factory('smtp',
   array ('host' => $host,
     'auth' => true,
     'username' => $username,
     'password' => $password));


$headers = array ('From' => "exampledomain.com",
          'To' => $to,
          'Subject' => $subject
          'MIME-Version' => "1.0",
          'Content-type' => "text/html; charset=iso-8859-1"
                   );

 $mail = $smtp->send($to,$headers,$msg_body);

1 个答案:

答案 0 :(得分:0)

在header数组中,您似乎在$ subject

之后缺少逗号