Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm using this module and am having some formatting issues with the HTML newsletters. I looked at the HTML source of the messages and saw two opening <bode>
tags:
</style>
</head>
<body id="mimemail-body">
<div id="center">
<div id="main">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<title>
: test</title>
</head>
<body bgcolor="#ffffff">
<style type="text/css">
<!-- -->
</style>
<table class="simplenews-template-background" width="100%" bgcolor="#ffffff" cellpadding="0" cellspacing="0">
<tr>
Is this a Simplenews Template issue or a Mimemail issue? Anyone else seeing this HTML document inside and HTML document issue?
Comments
Comment #1
Z2222 CreditAttribution: Z2222 commentedTypo above.. should say:
"two opening
<body>
tags"Comment #2
Z2222 CreditAttribution: Z2222 commentedIs this part of the code creating a duplicate HTML document within Mimemail's HTML document?
Here it is the HTML output in the newsletter. I'm using a mail.css file in my template to remove my theme's CSS. Notice that there are two HTML documents there:
Comment #3
Alex72RM CreditAttribution: Alex72RM commentedWith this problem the module is not usable (most of customized css is not rendered).
Surely better 1.1 version.
Comment #4
stevekerouac CreditAttribution: stevekerouac commentedSubscribe
Comment #5
TBarregren CreditAttribution: TBarregren commentedI can confirm the bug. It is due to changes in how the content is passed between the three modules Simplenews_template, Simplenews and MimeMail. I'll investigate it further.
Comment #6
keesje CreditAttribution: keesje commentedI can confirm this too.
Simplenews_template, Simplenews and MimeMail are all adding HTML to the message.
Please note that simplenews now has a templating method of its own by using the PHP theme engine.
I had to override a theme_ hook in mimemail to prevent it from adding HTML, deinstall simplenews_template and go with the simplenews templates to get smooth HTML without strange linebreaks or duplicate tags.
I would like to use simplenews_template still..
Comment #7
keesje CreditAttribution: keesje commentedOh, and disable base64 encoding for the message body in mimemail. Its in an issue somewhere here. This makes the message code readable for debugging.
Comment #8
TBarregren CreditAttribution: TBarregren commentedSee commit #168052. Will be inclued in the upcoming 5.x-1.3.
Comment #9
Alex72RM CreditAttribution: Alex72RM commentedHi,
many thanks for this new module version.
I noted however that the row:
from simplenews_template.tpl.php is stripped out from the sent newsletter (the html code has always a void row in place between
<head>
and<title>
tags).Comment #10
TBarregren CreditAttribution: TBarregren commentedThe
<meta>
-element is included in the HTML sent to the MTA, and it is visible in Thunderbird. I therefore believe it is your e-mail client that filters it out.But it is not a problem since Mime Mail sets the
Content-Type
totext/plain; utf-8
. Actually, I am not sure if any mail client respects<meta>
-element in the HTML.Comment #11
Alex72RM CreditAttribution: Alex72RM commentedHi again and thanks for your quick response,
I've investigated a little more this type of issue.
A lot of help has been given by print_mail (print submodule) that builds an html email without mimemail module.
I noticed that regarding headers information, print_mail sets up an header array variable:
$headers = array('Content-Type' => 'text/html; charset=utf-8');
and then sends emails with a drupal_mail command:
drupal_mail('print_mail_sendpage', $to, $params['subject'], $params['body'], $from, $headers);
On the contrary, basing the work on mimemail, simplenews_template sends the meta tag from a pre-defined html code to a mimemail function:
Mimemail sends a different type of content (plain or html) basing on user settings. What is the module output when the user is anonymous and then hasn't decided for an email setting or another (html/plain)? I found that with this condition, two versions of email are sent, melt into a single email (!):
First part: Content-Type: text/plain; charset=utf-8: all the content is plain, with a css preamble (ugly and unreadable)
Second part: Content-Type: text/html; charset=utf-8: html email correctly rendered
I think that the best approach is within print_mail (I know, we lose plain email... but nowadays who reads emails with a plain reader?)
Alessandro
Comment #12
Alex72RM CreditAttribution: Alex72RM commentedI noticed that this issue had "fixed" status.
On the contrary, discussions show that it's an active one.
Comment #13
TBarregren CreditAttribution: TBarregren commented@Alex72RM:
Could you please explain in what respect the bug is not fixed. The bug report talks about two
<body>
-tags, and as far as I can tell this bug is fixed. If you still see two<body>
-tags, don't hesitate to reopen this issue again to give details on how to recreate the bug.If you want to replace Mime Mail with an alternative, you should not discuss that in a bug report, but open a feature request. Since it is the Simplenews module that depends on Mime Mail to send HTML-email, you should open that feature request on that modules issue queue and not here.
This is how it is suppose to work. A client who request plain text should not get HTML-email, and all others should have a multipart e-mail.
Again, if you don't like this, you should either open a feature request on the Mime Mail issue queue, requesting this behavior to change, or on the Simplenews issue queue, requesting Mime Mail to be replaced.
Comment #15
kenorb CreditAttribution: kenorb commentedPatch for 6.x version: #373915: Two <html> tags