Drupal 7 drupal_mail剥离HTML?

Cor*_*her 5 html php content-type drupal sendmail

我有一个自定义模块,我正在尝试使用drupal_mail函数生成HTML电子邮件(D7).邮件正在通过,甚至显示text/html,但是某些地方似乎在它到达收件箱之前剥离了HTMl.

首先,在一个函数中,我正在构建我的标题/正文/其他变量并发送到自定义函数:

    $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);
Run Code Online (Sandbox Code Playgroud)

然后我有latch_mail latch_send_email函数:

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'];
}
Run Code Online (Sandbox Code Playgroud)

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);
}
Run Code Online (Sandbox Code Playgroud)

我希望通过我的标签和br标签来发送电子邮件,但它是这样的:

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
Run Code Online (Sandbox Code Playgroud)

不知怎的,它正在接受我的链接,并在完全删除br标签时将它们变成脚注.

您可以提供的任何帮助将不胜感激.谢谢!

Tel*_*iRE 4

Drupal 无法直接发送 HTML 电子邮件。为了让 Drupal 支持 HTML 电子邮件,您需要 HTML 邮件模块。http://drupal.org/project/htmlmail 一旦您确定所有 HTML 都应按原样发送。