I've installed the latest simplenews (April 18 dev version) together with the last (5.x-1.0, manually "patched" according to http://drupal.org/node/195466) mimemail package. The messages generated seems to be somehow messed...

When I select an HTML message format for the newsletter, I receive a text message, which looks as a body converted from HTML to text (reformatted). There are no HTML tags in the body, but they are there in the footer (unsubscribe link part). I believe also the body shouldn't be converted to text (reformatted), but should also include HTML tags (as I suspect mimemail doesn't do the job well...).

When I select a plain text message format, I receive the mail with a body converted (no HTML tags, also reformatted to text), but the footer this time doesn't include any HTML tags (this is as it should be).

When I've commented out the conversion line in simplenews module, the message received contained all HTML tags in a body part (which was also not reformatted...), no matter if HTML or plain text was selected (the header was plaintext only again, without HTML part - but, as said, this probably is a problem of mimemail...). Footer part was with or without HTML tags (according to the selection) again (as with original / unchanged simplenews.module file).

Is it possible to test anyhow what exactly mimemail receives as an input?

I suspect there is something inconsistent in simplenews body generation part, as otherwise I would expect a body part and a footer (unsubscribe link) part to both contain HTML tags or not (probably the message is passed to mimemail in 1 part, not splitted, or?). Besides, it is obvious that simplenews converts the message into the text formatting also when HTML is chosen (converted title and links...).

Comments

sutharsan’s picture

Category: bug » feature

There has been no effort made yet in the simplenews - mimemail cooperation. Therefore I mark this as a feature request.
The cause of your problem is not necessarily in simplenews. The mimemail conversion to 6.x is still in an very early stage and currently my priorities are to finalize the simplenews 'stand alone' features.

Feel free to further investigate the cooperation between mimemail and simplenews. Patches are welcome!
What mimemail receives (and simplenews generates) is in the $message variable in the various mail functions:
drupal_mail()
simplenews_mail()
drupal_mail_send()
mimemail_mailengine()
mimemail_mail_alter()

luti’s picture

I've worked a bit on mimemail to get it work with core contact module (see 195466 / #8). It seems to work (for me) pretty well now...

I am noticing that also simplenews mails seem to be sent as HTML after all of the changes made to mimemail, but there are 2 weirdnesses present:

  1. no matter what is selected at newsletter edit form ("HTML" or "plain" option), it seems an HTML message is always sent out...
  2. this message has a header (defined through CSS) and a footer formatted properly (with relevant HTML tags), but the body itself seems to be "formatted" as it has to be a plain text one (no matter what option I choose, "HTML" or "plain") - without any HTML tags and with ----- lines around the title...

I absolutely don't blame simplenews module for that, at least not for the first issue. I would however appreciate if someone can test such a combination on his/her system, and provide some feedback (ideas what may be a reason and how to resolve it).

sutharsan’s picture

Assigned: Unassigned » sutharsan

Thanks for stepping forward and working on this part! You are the first one to test, since it is the first piece of working 6.x mimemail. Hardly no mimemail integration is available in simplenews yet. Based on your above mentioned code I will investigate it.

luti’s picture

Thank you.

cbenoist’s picture

StatusFileSize
new1.71 KB

I did a bit of playing and got html mail working with mimemail for the cron emails. It checks for the mimemail module and also checks to see if the format is html or plain. This code would need to be used in other places, but I thought a good start would be to test it in cron. We could make this code a method that other places emails are sent can easily call.

Sorry if I jumped in on this, but I have a few people who want this functionality.

sutharsan’s picture

I will wait until a drupal 6 compatible version of mime mail is available before I commit a mimemail integration of simplenews. But that should not hold us back to work on code for it.

For The Youthie (a Tamworth Regional Council Youth Centre, NSW, Australia) I am working on an implementation of mimemail and simplenews for their Drupal 6 site. The code is in testing phase and will be published here when finished.

luti’s picture

I can confirm that I am finally getting the correct HTML test mails after applying the patch above. Thanks, Sutharsan.

There remains the weirdness that "Use mime mail for all messages" option has to be ticked this to work (otherwise, I get a text message with HTML tags...), but it seems to be a mimemail issue...

luti’s picture

I see a new 6.x-1.x-dev version (May 27) is out, but this patch is not included.

Without, HTML mails are sent out as before (as plain text messages only).

holydrupal’s picture

the confirmation messages is also wont send by mime and they are in plain text format

sutharsan’s picture

Assigned: sutharsan » Unassigned
Status: Active » Postponed
StatusFileSize
new6.11 KB

For those who can not wait for mimemail to get moving and need to get a working simplenews HTML mail solution, here is a patch (to HEAD) of the work I did for The Youthie. Sponsored by Tamworth Regional Council Youth Centre, NSW, Australia.

This patch to simplenews must be combined with the following patches to Mimemail HEAD (revision 1.24):
Issue 259821: http://drupal.org/files/issues/mimemail.codestyle_HEAD.patch
Issue 195466, #16: http://drupal.org/files/issues/mimemail.upgrade02.patch

The attached patch will not be committed to Simplenews before at least a Drupal 6 compatible HEAD version of Mime mail is available.
Further requests for HTML support for simplenews 6.x is therefore useless. Simplenews will only support plain text until further notice.

luti’s picture

This patch doesn't seem to be suitable for recent versions. How shall we proceed to get HTML mails option - can you make the exception and provide a new patch, or shall we stick with the old version of module?

sutharsan’s picture

The above patches were the result of a custom upgrade of mime mail and simplenews I did. I have no plans to keep he patches up to date with the Progress of Simplenews (unless I get a new job request).

VaZso’s picture

I've tried the patches to get a working version of Simplenews with HTML on drupal 6.3, but I wasn't succesful...

I've applied the patch on Simplenews 6.x-1.0-beta1 (I didn't found any other versions the patch working with, so I thing the patch made for this version), there was no errors.

Also, I've downloaded the mimemail head and tried to apply the patches, but I don't know the tries was wrong or not...
I've tried to patch it with mimemail.codestyle_HEAD.patch first, then with mimemail.upgrade02.patch by -R option, which had 2 of the parts not applied. (I've also had other tries.)

Now, I cannot send news with simplenews module, because all the contents I try to send goes to Draft folder and get a red 'x' letter near it.

Other mails (for example, in the contacts field) still working in html.

What did I wrong?
I hope you can help me.

Thanks a lot.

sutharsan’s picture

Sorry, I do not support for this before at least a Drupal 6 compatible HEAD version of Mime mail is available

VaZso’s picture

OK, sorry for my comment.
I just tried to regenerate the modules you worked on by apply the patches you submitted.

I think I didn't find the version of mimemail the submitted patches based on.
May you (or somebody) send the patched version somehow?

I really would like to use newsletters on a Drupal 6 site with a little html formatting...
It would be great if I can try the correctly patched module, maybe it would work for me also.

Sorry again.

sutharsan’s picture

See also the (duplicate) feature request at: http://drupal.org/node/287676

matthewbot’s picture

Status: Postponed » Needs review
StatusFileSize
new6.25 KB

I updated #10 to apply to HEAD. A lot of code seems to have changed from when that patch was made, so much of my patch is new. I kept the code that sets $message['format'] in simplenews_mail(). But I took a slightly different approach with simplenews_backend_send(), and created simplenews_backend_mail() instead, which is a drop in replacement to drupal_mail() that automatically uses mimemail() when available. This simplified code, and doesn't require module_exists('mimemail') to be scattered everywhere. I then went through and replaced every instance of drupal_mail() with simplenews_backend_mail().

With this patch and my Mimemail patch, I've been able to send simple HTML messages, but I haven't yet tested with CSS or HTML.

This is my first time working with patches or contributing to Drupal, so let me know if I've done something incorrectly. I'd also take suggestions on a better way to implement mimemail, if perhaps there was some benefit to the simplenews_backend_send() approach that I didn't realize.

matthewbot’s picture

Status: Needs review » Postponed

Looks like there is still work to do before an official Mimemail 6.x gets started, so I guess this is still postponed. I'm still using my patch for a usable mimemail + Simplenews on 6.x which I need now, so if anyone uses it and runs in to issues I'd certainly like to know and make a fix. But otherwise this won't be going in any time soon.

VaZso’s picture

I've found this thread today again, and I tried matthewbot's patch to simplenews.
It looks very well.

I don't know which patch I've added to my mimemail module, but it seems now I can send my newsletters correctly.
I will test it a little bit more, but it could attach my images to the newsletter.
Maybe I had a little problem with permissions, because if I took the picture from my own directory, it never attached to the mail (I saw just it's place), but when I submitted the image with upload to a common space, it always attached it correctly, so I think it is not mimemail's problem.
(So, the images attached to the mail itself, and also it attached my smileys :) )

Also, I can switch between html and plain text mails without any problems (in the post newsletter section), it seems both are working.

Maybe one thing I will try to remove, the mail's subject appears also in the beginning of the mail... and I don't like it... :)
...but it is absolutely ok now.

I will test it a little bit, but it seems I can use it very well.
Thank you your works.

AlexisWilke’s picture

I just added another fix for Mimemail on that node, which was referenced earlier.

http://drupal.org/node/195466

sutharsan’s picture

Status: Postponed » Closed (won't fix)

This method (#10, #14) of solving the Mime Mail compatibility will not be implemented.
See http://drupal.org/node/305650 for the current solution.