小编Cor*_*her的帖子

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

html php content-type drupal sendmail

5
推荐指数
1
解决办法
3921
查看次数

标签 统计

content-type ×1

drupal ×1

html ×1

php ×1

sendmail ×1