Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9003519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:43:20+00:00 2026-06-16T00:43:20+00:00

I have a custom module that I’m trying to generate an HTML email from

  • 0

I have a custom module that I’m trying to generate an HTML email from using the drupal_mail function (D7). Mail is coming through, and even shows text/html, however something somewhere appears to be stripping out the HTMl before it gets to an inbox.

First, in a function I’m building my title/body/other vars and sending to a custom 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 the emails to come through with my a tags and br tags, but it comes through like this:

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

Somehow it’s taking my links and turning them into footnotes while removing the br tags completely.

Any help you can provide would be appreciated. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:43:21+00:00Added an answer on June 16, 2026 at 12:43 am

    Out of the box, Drupal can’t send HTML email. In order for Drupal to support HTML email you need the HTML Mail module. http://drupal.org/project/htmlmail Once you have that all HTML should be sent as such.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have custom drupal module. I receive result from a webservice that I need
I have created a custom module that includes a hook_submit function. Is it possible
I have created a custom module that sets a system variable using variable_set(). I
I have a custom module that returns data from a web service call. It
I'm trying to create a custom module using Magento's EAV structure and have been
I have module that implements custom content type via NodeAPI hooks ( hook_insert ,
I have a custom module I made for Magento. From the admin, there is
I have created a custom module that creates a custom Database table. I have
I have created a custom module and am using hook_block to programmatically create some
I have a custom HTTP Module. I would like to inject the logger using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.