I have a custom module that I am trying to create an HTML email using the drupal_mail (D7) function. Mail goes through and even shows the text / html, however something somewhere seems to delete the HTMl before it gets to the inbox.
First, in the function, I create my header / body / other vars and send the user-defined function:
$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);
Then I have the latch_mail latch_send_email functions:
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'];
}
and
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);
}
I would expect emails to go through with my tags and br tags, but this happens as follows:
We thought you'd like to know that John Doe has marked your project as completed. Please visit the link at http:
Somehow he takes my links and turns them into footnotes, completely removing the br tags.
Any help you can provide will be greatly appreciated. Thank!