html emails wrapping like plain text

fudge714 - July 21, 2009 - 15:57
Project:HTML Mail
Version:6.x-1.2
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I've got a weird issue where gmail is wrapping the results of an HTML email sent through the notify module. This means for instance that I've got a
showing up in the middle of an a tag and breaking it..
format=flowed should be fixing this shouldnt it?
Other links without line breaks in the middle, and other html tags are working.
I have somewhat modified notify.module to change the way the emails are displayed, but pretty sure I have only changed what gets printed in the email, nothing important..
Am pasting what I get by clicking on 'show original' within gmail..

Delivered-To: fudge714@gmail.com
Received: by 10.229.105.17 with SMTP id r17cs407863qco;
        Tue, 21 Jul 2009 08:26:47 -0700 (PDT)
Received: by 10.140.193.9 with SMTP id q9mr3309972rvf.70.1248190006944;
        Tue, 21 Jul 2009 08:26:46 -0700 (PDT)
Return-Path: <contact@thesharehood.org>
Received: from axxs.org (axxs.org [76.74.237.21])
        by mx.google.com with ESMTP id k2si6759555rvb.32.2009.07.21.08.26.45;
        Tue, 21 Jul 2009 08:26:46 -0700 (PDT)
Received-SPF: neutral (google.com: 76.74.237.21 is neither permitted nor denied by best guess record for domain of contact@thesharehood.org) client-ip=76.74.237.21;
Authentication-Results: mx.google.com; spf=neutral (google.com: 76.74.237.21 is neither permitted nor denied by best guess record for domain of contact@thesharehood.org) smtp.mail=contact@thesharehood.org
Received: (qmail 24019 invoked by uid 33); 21 Jul 2009 15:26:45 +0000
Date: 21 Jul 2009 15:26:45 +0000
Message-ID: <20090721152645.24015.qmail@axxs.org>
To: fudge714@gmail.com
Subject: The Sharehood new content notification for  suse (42)
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8; format=flowed;
Content-Transfer-Encoding: 8Bit
X-Mailer: Drupal
Errors-To: contact@thesharehood.org
Sender: contact@thesharehood.org
Reply-To: contact@thesharehood.org
From: contact@thesharehood.org

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<body id="htmlmail">


   <div id="htmlmail-body">
   <p>Welcome to your bi-weekly update email from <a 
href="http://www.thesharehood.org" 
title="www.thesharehood.org">www.thesharehood.org</a>. Each week new events, 
forum posts, replies, and photos will be listed in this email, so you won't 
have to check the site to stay up to date.<br><br>If you want to post to the 
site and have your content emailed out in the next email, you can use these 
links:<br><a href=http://www.thesharehood.org/node/add/item>Post an Item</a> 
| <a href=http://www.thesharehood.org/node/add/event>Post an Event</a> | <a 
href=http://www.thesharehood.org/node/add/forum>Post a Forum Topic</a> | <a 
href=http://www.thesharehood.org/node/add/image>Post Photos</a><br><br />
<hr><br><b>Recent content - 1 new post</b><br>1. <a<br />
href=http://www.thesharehood.org/node/1435>test</a><br>Published Forum<br />
topic by admin<br>testing</p>
<p><a href=http://www.thesharehood.org/comment/reply/1435>Reply to this<br />
post</a><br><br><b>Recent comments - !count new comments</b><br>!count<br />
new comments attached to Forum topic posted by admin: test<br>   1. <a<br />
href=http://dev.thesharehood.org/node/1435#comment-15>test</a> by<br />
admin<br>   2. <a<br />
href=http://dev.thesharehood.org/node/1435#comment-16>testing no<br />
comment subject</a> by admin<br><br><br />
<hr><br><a href=http://www.thesharehood.org/node/add/item>Post an Item</a> | 
<a href=http://www.thesharehood.org/node/add/event>Post an Event</a> | <a 
href=http://www.thesharehood.org/node/add/forum>Post a Forum Topic</a> | <a 
href=http://www.thesharehood.org/node/add/image>Post Photos</a><br>This is an 
automatic e-mail from The Sharehood.<br>To stop receiving these e-mails, 
change your <a href=http://dev.thesharehood.org/user/42/notify>notification 
preferences</a><br></p>
   </div>


</body>
</html>

any help appreciated

#1

xweb - July 21, 2009 - 19:53

Looking at notify.module code, mail from notify is getting converted to text in the function _notify_content() around line 386
HTML Mail in turn is converting the line breaks to br's.

<?php
return drupal_html_to_text($txt);
?>

If there was a check for htmlmail.module here, returning straight html should work ok.

<?php


if (module_exists('htmlmail')) {
  return
$txt;
}
else {
  return
drupal_html_to_text($txt);
}
?>

Maybe something notify module maintainers would change for a new release -- you'd have to ask.

PS I've not tested this, just assuming this is the cause. Test this before submitting a feature request to notify project. Let me know, i'm interested in the result.

 
 

Drupal is a registered trademark of Dries Buytaert.