The thank you email is showing paragraph containers in the message. I entered no HTML in that field when I configured it. Is there some way around this?

Comments

ggaetz’s picture

Are you using a WYSIWYG editor for that field? Disabling it for that particular form field might do the trick.

m.e.’s picture

No, I don't even have a WYSIWYG installed on this site.

The text I have entered in that form field is "We appreciate your spreading the word." When it arrives, the email reads

<p>We appreciate your spreading the word.</p>

I've tested this in both the Gmail interface and Eudora.

Patricia_W’s picture

I had the same problem, which I resolved by adding code to the module so that it sent the thank you message using the HTML code that was used for the message (which should have been the case originally).

Patricia_W’s picture

Here the replacement code I used for the tellafriend_node_mail function in tellafriend_node.module
The code for case 'taf_thank_you' was modified to add the multi-part headers that are used for the message.

/*
 * Implementation of hook_mail
 */
function tellafriend_node_mail($key, &$message, $params) {
  switch ($key) {
    case 'taf':
      $message['subject'] .= str_replace(array("\r", "\n"), '', check_plain($params['subject']));

      if ($params['send_multipart_email'] == TRUE) {
        $message['headers']['Content-Type'] = 'multipart/alternative; boundary="-=000000-000000"';
        $message['headers']['Content-Transfer-Encoding'] = '8bit';
        $message['headers']['Content-Disposition'] = 'inline';
        $message['body'][] = 'This is a multi-part message in MIME format.';
        $message['body'][] = '---=000000-000000' . "\n"  .'Content-Type: text/plain; charset="iso-8859-1"' . "\n";
      }
      if ($params['send_ecard'] == TRUE) {
        global $base_url;
        $sender = $params['first_name'] . ' ' . $params['last_name'] . ' [' . $params['email'] . ']'; 
        $message['body'][] = "You have received an ecard from " . $sender . ". Follow the link below to read your ecard:\n";
        $message['body'][] = $base_url . '/node/' . $params['nid'] . '/message/' . $params['message_id'];
        $message['body'][] = "----------";
      }
      $message['body'][] = drupal_html_to_text($params['message']);
      $message['body'][] = "----------";
      $message['body'][] = drupal_html_to_text($params['constant_text']);
      $message['body'][] = "----------";
      if ($params['send_ecard'] == TRUE) {
        global $base_url;
        $sender = $params['first_name'] . ' ' . $params['last_name'] . ' [' . $params['email'] . ']'; 
        $message['body'][] = "You have received an ecard from " . $sender . ". Follow the link below to read your ecard:\n";
        $message['body'][] = $base_url . '/node/' . $params['nid'] . '/message/' . $params['message_id'];
      }
       
  
      if ($params['send_multipart_email'] == TRUE) {
        $message['body'][] = '---=000000-000000' . "\n"  .'Content-Type: text/html; charset="iso-8859-1"' . "\n";
        if ($params['send_ecard'] == TRUE) {
          global $base_url;
          $sender = $params['first_name'] . ' ' . $params['last_name'] . ' [' . $params['email'] . ']'; 
          $additional = '<p style="margin-top: 24px; padding-top: 16px;  border-top: 1px solid #777;">You have received this ecard from ' . $sender . '.</p><p>Follow the link below to read your ecard in your browser:<br />';
          $additional .= $base_url . '/node/' . $params['nid'] . '/message/' . $params['message_id'] . '</p>';
          $additional .= theme('tellafriend_node_link', $params['nid']);
          $ecard_image = '<img src="' . $base_url . '/' . $params['ecard_image'] . '" alt="' . $params['subject']  . '" style="border: 1px solid #ddd;" />';
          if (isset($params['ecard_link'])) {
            $ecard_image = '<a href="' . $params['ecard_link'] . '">' . $ecard_image . '</a>';
          }
          $message['body'][] = $additional . '<br /><br />' . preg_replace('/%content%/', $ecard_image . check_markup($params['message']) . '<div style="margin-top: 24px; padding-top: 16px; border-top: 1px solid #777;">' . $params['constant_text'] . '</div>', $params['wrapper']);
        }
        else {
          $message['body'][] = preg_replace('/%content%/', check_markup($params['message']) . '<div style="margin-top: 24px; padding-top: 16px; border-top: 1px solid #777;">' . $params['constant_text'] . '</div>', $params['wrapper']);
        }
        $message['body'][] = '---=000000-000000--';
      } 
  
      if ($params['send_ecard'] == TRUE) {
        global $base_url;
        $sender = $params['first_name'] . ' ' . $params['last_name'] . ' [' . $params['email'] . ']'; 
        $additional = "<p>You have received this ecard from " . $sender . ".</p>";
        $additional .= theme('tellafriend_node_link', $params['nid']);
        //$message['save'] = preg_replace('/%content%/', '<img src="' . $base_url . '/' . $params['ecard_image'] . '" alt="" />' . check_markup($params['message']) . $additional . $params['constant_text'], $params['wrapper']);
        $message['save'] = $additional . '<br /><br />' . preg_replace('/%content%/', $ecard_image . check_markup($params['message']) . '<div class="tellafriend_node-archived-message-constant-text">' . $params['constant_text'] . '</div>', $params['wrapper']);
      }
      break;
     case 'taf_thank_you':
      $message['subject'] .= str_replace(array("\r", "\n"), '', $params['subject']);

      /* changed this code to send formatted mail for thank you */
    if ($params['send_multipart_email'] == TRUE) {
        $message['headers']['Content-Type'] = 'multipart/alternative; boundary="-=000000-000000"';
        $message['headers']['Content-Transfer-Encoding'] = '8bit';
        $message['headers']['Content-Disposition'] = 'inline';
        $message['body'][] = 'This is a multi-part message in MIME format.';
        $message['body'][] = '---=000000-000000' . "\n"  .'Content-Type: text/plain; charset="iso-8859-1"' . "\n";
      }
      $message['body'][] = $params['message'];
       if ($params['send_multipart_email'] == TRUE) {
        $message['body'][] = '---=000000-000000' . "\n"  .'Content-Type: text/html; charset="iso-8859-1"' . "\n";
        $message['body'][] = preg_replace('/%content%/', check_markup($params['message']) . '<div style="margin-top: 24px; padding-top: 16px; border-top: 1px solid #777;">' . $params['constant_text'] . '</div>', $params['wrapper']);
        $message['body'][] = '---=000000-000000--';
      } 
 
  }