php – Drupal 7 drupal_mail剥离HTML?

前端之家收集整理的这篇文章主要介绍了php – Drupal 7 drupal_mail剥离HTML?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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

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

    $body = "We thought you'd like to know that ".$fullname." has marked your project as completed.
    

然后我有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'];
}

function latch_send_mail($key,$to,$from,$body,$headers='') {
    $params['body']=$body;
    $params['subject'] = t($title);
    return drupal_mail('latch',$key,language_default(),$params,TRUE);
}

我希望通过我的标签和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

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

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

最佳答案
开箱即用,Drupal无法发送HTML电子邮件.为了让Drupal支持HTML电子邮件,您需要HTML Mail模块. http://drupal.org/project/htmlmail一旦你有了所有HTML应该这样发送.
原文链接:https://www.f2er.com/html/425875.html

猜你在找的HTML相关文章