我可以完美地发送电子邮件,但它们以纯文本形式显示,我一直在尝试很多解决方案将其显示为 HTML 试图放置内容类型,但是当我检查发送的电子邮件中的标题时,MIME 和内容类型标题丢失. 我做错了什么?
谢谢!
$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);