Note: Not related to #321079: Multi-part message in MIME format wrong plain text format.
When I send a simplnews newsletter it is arriving in the inboxes of everyone as a plain text email but all the elements are wrapped in html tags. For example:

<h2>title of the newsletter</h2>
<p>information blah blah blah</p>
<p>yet more information you can't live without<br />
unless of course you live under a rock.</p>
<p>see ya,<br />
me</p>

I do not have mime mail installed.

Background: I had this formerly set up as a Drupal 5.x site with simplenews and mimemail. When I upgraded my site to Drupal 6.x I disabled both and only installed simplenews for the updated site. For more than a month I have been sending simplenews newsletters out, But suddenly I am getting this problem after the update from Drupal 6.4 to 6.5.

CommentFileSizeAuthor
#3 simplenews.321750.patch5.8 KBsutharsan

Comments

tcblack’s picture

Version: 6.x-1.0-beta5 » 6.x-1.x-dev

Fixing version number.
It appears the dev version expects mimemail to be installed?
After installing Mime Mail 6.x-1.x-dev (2008-Sep-21) the problem was solved. Still you should be able to use simplenews without mime mail.

ddanier’s picture

Status: Active » Needs review

Seems like this is a real bug, which has nothing to do with wether mimemail is used or not. What mimemail does here is really sending HTML-mails, the but itself remains.

After digging around in the code for some time I found, that the email is converted to plain text in simplenews.module on line 1514. The code here ready like this:

      if ($context['node']->simplenews['s_format'] == 'plain') {
        $body = simplenews_html_to_text($body);
      }

It seems like the array under $context['node']->simplenews has changed, so $context['node']->simplenews['s_format'] does not exist anymore. Changing it into $context['node']->simplenews['advanced']['s_format'] fixes the problem and mails get sent using plain text.

I'm changing the status of this ticket to patch (code needs review), however I do not append a patch. The change is far to simple for this. ;-)

sutharsan’s picture

Status: Needs review » Fixed
StatusFileSize
new5.8 KB

Yes, it is this simple. However the same trick needs to be applied to a lot more places in the module. The attached patch fixes this.
Patch committed.

ddanier’s picture

You're right. I just tested this with sending test-emails. When the newsletter is send for real (I use cron for this) changing line 1514 does not do the trick. Thanks for the patch. :)

jmail.af’s picture

Status: Fixed » Active

Hi,

Sorry I am new to drupal, and I would also like to use the patch above - but how exactly do you use the patch? Do I download that file and then just insert it into the simplenews module?

Thanks in advance for any help.

sutharsan’s picture

Status: Active » Fixed

patch committed means applied to the development version. Just download 6.x-1.x-dev.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.