Tôi có một mô-đun tùy chỉnh mà tôi đang cố tạo email HTML từ việc sử dụng hàm drupal_mail (D7). Mail đang đến, và thậm chí còn hiển thị text/html, tuy nhiên một cái gì đó ở đâu đó dường như đang loại bỏ HTMl trước khi nó đến hộp thư đến.Drupal 7 drupal_mail tước HTML?
Thứ nhất, trong một chức năng Tôi đang xây dựng tiêu đề/body/vars khác của tôi và gửi đến một chức năng tùy chỉnh:
$body = "We thought you'd like to know that ".$fullname." has marked your project as completed.
<br /><br />
Please visit the link at <a href='http://".$_SERVER['HTTP_HOST']."/survey/customer/".$customer[0]->unique_id."'>http://".$_SERVER['HTTP_HOST']."/survey/customer/".$customer[0]->unique_id."</a> to take the survey.";
$returnMail = latch_send_mail('pro_realized',$customer[0]->customer_email,$user->mail,$title,$body);
Sau đó, tôi có các chức năng latch_send_email latch_mail:
function latch_mail($key, &$message, $params) {
$headers = array(
'MIME-Version' => '1.0',
'Content-Type' => 'text/html; charset=UTF-8; format=flowed',
'Content-Transfer-Encoding' => '8Bit',
'X-Mailer' => 'Drupal'
);
foreach ($headers as $key => $value) {
$message['headers'][$key] = $value;
}
$message['body'][] = $params['body'];
$message['subject'] = $params['subject'];
}
và
function latch_send_mail($key,$to,$from,$title,$body,$headers='') {
$params['body']=$body;
$params['subject'] = t($title);
return drupal_mail('latch', $key, $to, language_default(), $params, $from,TRUE);
}
Tôi hy vọng các email sẽ đi kèm với thẻ của tôi và thẻ br, nhưng nó đến ugh như thế này:
We thought you'd like to know that John Doe has marked your project as completed. Please visit the link at http://latch.local/survey/customer/34c91b8883cd70b32c65feb7adf9c393 [1] to take the survey. [1] http://latch.local/survey/customer/34c91b8883cd70b32c65feb7adf9c393
Bằng cách nào đó liên kết và chuyển chúng thành chú thích cuối cùng trong khi xóa thẻ br hoàn toàn.
Bất kỳ trợ giúp nào bạn có thể cung cấp đều sẽ được đánh giá cao. Cảm ơn!