The attached patch makes some required upgrades for Drupal 6, kills some PHP notices, standardizes some of the PHP formatting, and switches generic use of the word "Mail" to "Mime Mail" so this module stops stepping on the Mail module's namespace.

I marked the patch as needs work because I've only tested it with the dev version of the Mail module. The HTML versions of emails don't display any content in Thunderbird (even though the email source shows there is some content), but plaintext does. Haven't worked deep enough to blame this patch or Mail yet.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rayarub’s picture

Subscribing.

Allie Micka’s picture

Hey there,

I'd like to make sure that some of these hit the D5 version ( e.g. formatting and PHP notices ). Please remember that it's more helpful to post patches for this stuff separately :)

Anonymous’s picture

Hi,

The listed attachment is a '.patch' file. How can I patch the older version with this patch?

Regards,
malviya

physiotek’s picture

Subscribing.

bacchus101’s picture

I can't seem to get the patch to work. Not sure where I am going wrong. Any help would be appreciated.

me$ patch -p0 < mimemail-diff-2007-11-26-13-12-19.patch
patching file mimemail.inc
Hunk #1 FAILED at 3.
Hunk #2 FAILED at 39.
Hunk #3 FAILED at 58.
Hunk #4 FAILED at 66.
Hunk #5 succeeded at 44 (offset -51 lines).
Hunk #6 FAILED at 61.
Hunk #7 FAILED at 109.
Hunk #8 FAILED at 117.
Hunk #9 FAILED at 142.
Hunk #10 FAILED at 166.
Hunk #11 FAILED at 195.
Hunk #12 FAILED at 239.
Hunk #13 FAILED at 255.
Hunk #14 FAILED at 275.
Hunk #15 FAILED at 285.
Hunk #16 FAILED at 322.
Hunk #17 FAILED at 332.
Hunk #18 FAILED at 351.
Hunk #19 FAILED at 374.
Hunk #20 FAILED at 435.
19 out of 20 hunks FAILED -- saving rejects to file mimemail.inc.rej
patching file mimemail.info
Hunk #1 succeeded at 1 with fuzz 2.
patching file mimemail.module
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 38.
Hunk #3 FAILED at 60.
Hunk #4 FAILED at 104.
Hunk #5 FAILED at 161.
Hunk #6 FAILED at 178.
Hunk #7 FAILED at 229.
Hunk #8 FAILED at 260.
Hunk #9 FAILED at 287.
Hunk #10 FAILED at 318.
10 out of 10 hunks FAILED -- saving rejects to file mimemail.module.rej

encho’s picture

subscribing

jorisx’s picture

would love to see a mime mail 6 alpha version :)
subscribing!

LUTi’s picture

FileSize
20 KB

I've tried to clean the code (using "Coder"), and add/edit some code (to/from the version I've got through the patch provided above - I've had to do that, as mimemail didn't work for me as it was...). I'll try to attach the complete module (all files needed) to this post.

Please note that I've had to apply a quick fix for my mail system, for which I have to provide "-f " option string (additional lines 290 - 301, and changed line 307). This part is probably not needed generally. Maybe in the future it would be good to improve this solution (or as a variable settable through admin screen or some value, "automatically" retrieved from the system...), but at the moment I really don't have time to do that...

It seems mimemail works in my system as it is (I've tested it with latest simplenews module test newsletter and with core contact module - with "Use mime mail for all messages" option selected). The only thing I've noticed is that (at least I believe so) I've received an HTML message even if I've selected a "plain" one when editing a newsletter. But, I am not sure yet due to which part (module) it is so (weather it is mimemail or simplenews module).

I would appreciate any fixes still needed, as well as any other comments or considerations. I also suggest a maintainer of this module to publish some 6.x alpha version, so it will be easier to follow the development through "Available updates" in the future.

Sutharsan’s picture

Your work is very much appreciated, but as Allie Micka stated (#5) it is very helpful if you:
1. Split the patches (where possible) in parts: code clean-up, upgrade, new features, bug-fixes.
2. Supply patches. Supplied code can be VERY helpfull for module maintainers, but quality varies (no, nothing personal) and patches are the way the changes can quickly be scanned and judged.

LUTi’s picture

You've probably thought post #2, Sutharsan...? ;-)

Even if I don't understand Allie Micka's complain, as the initial attached file (mimemail-diff-2007-11-26-13-12-19.patch) seems to be a patch... Generally also agree with your concept, but I've had my reasons to put complete files there - please see below.

The problem was where exactly to start with patches (posts #3 and #5 are just confirming that to me). As I rememer, I've had quite some troubles to find the right version of mimemail (digging in CVS versions...) to which I've applied the initial patch at the end (yes, it is quite some mess with mimemail abou that, unfortunately...). Therfore, I've decided to make the life easier to users, and to attach the complete module (all files).

In many cases, I appreciate such complete packages, when we have many "unofficial" versions, and I just need something "more or less working" (please note I am not a developer, I'd just like to have a working Drupal 6 site in the configuration I need ASAP...) - just to be able to make all other changes in the content and themes I still have to do before my production site will be more or less ready to switch to a new version...

Maintainers and developers can probably always do some diff to the version they like (consider as the right one to do that; it would be much more straightforward if we wold have some "official" - at least alpha - 6.x version out already!). If it is too complicated, just publish the link to the version to which I have to do it, please... ;-)

I agree about commenting the changes 100%, but all I've done is to try to make it compatible with Drupal 6 changes... First I went through "coder" complains, and after that I had to get rid of errors reported after I've tried to send a message with core "contact" module (as above, through "mimemail"). I've found the arguments of some functions seem to be changed in between, and that's it. No code clean-up, no new features, no bug-fixes... Just the effort to ensure Drupal 6 compatibility.

But, what I've done was just enough Drupal not to throw out any errors at my system at the moment. There is however no guarantee that I've done it right, as I was not able to find exact specifications in many cases, just some similar functions etc. Therfore, it is here for some more skilled programmers to check about the changes (probably there will have to be some corrections before we can declare it as Drupal 6 compatibility fixes!) and for testers to check about expected residual errors in different environments...

So, what exactly to put there?! ;-)

Sutharsan’s picture

For an operation like this you should always use the HEAD version of the module as a starting point: http://drupal.org/node/95867
You have cleared the header of the files (for example: /* $Id: mimemail.module,v 1.23 2008/02/28 22:42:03 vauxia Exp $ */). Which version(s) have you used to build your version?

I can understand that you have submitted the module like this, but a problem occurs when in the mean time other changes are committed to cvs or when your code clean-up work must be back-ported to 5.x-1.x-dev. Not having patches will lead to extra work or requires all work to be re-done.
Furthermore you dramatically increase the chance that your work will be accepted by the module maintainer if you use (clean) patches.

Don't get me wrong, I appreciate the effort you have put into this. But I try to explain why developers do it the way they do, and why it is good to comply to this.

i.m.o. a proper segmentation of patches should be:
- code clean-up and documentation changes (this can be rolled back onto 5.x-1.x-dev)
- all other code changes witch can rolled back onto 5.x-1.x-dev
- all other code changes required for upgrade to 6.x

Sutharsan’s picture

Assigned: Unassigned » Sutharsan

Code is on its way.
I have received an order to upgrade Mimemail to Drupal 6. Where possible I will use the supplied code above, but no new features will be included.
The code will be made available and so will be the code clean-up for 5.x-1.x-dev.

@Allie: please contact me by pm as I like to cooperate with you on this.

Sutharsan’s picture

Status: Needs work » Needs review
FileSize
5.96 KB

Attached patch upgrades HEAD to drupal 6.x. Is must be preceded by #259821 code style patch.
It is very much like LUTi's patch. But there are a number of additional changes required/desired for which I will create separate issues.
Credits go to LUTi on which shoulders I stand here.

LUTi’s picture

Sutharsan,

I see you've removed two array checks in the code - are you sure the #257249: faulty header definition of paypal debug email issue (or something in this manner) will not pop up eventually again due to that?

Sutharsan’s picture

I guess you are referring to these parts of you 'patch':

@@ -52,6 +52,9 @@ function mimemail_headers($headers, $fro
   preg_match('/[a-z0-9\-\.]+@{1}[a-z0-9\-\.]+/i', $from, $matches);
   $from_email = $matches[0];
   // allow a mail to overwrite standard headers.
+  if (! is_array($headers)) {
+    $headers = array();
+  }
   $headers = array_merge(array('Return-Path' => "<$from_email>", 'Errors-To' => $from, 'From' => $from, 'Content-Type' => 'text/plain; charset=utf-8; format=flowed'), $headers);
 
   return $headers;
@@ -190,7 +189,11 @@ function mimemail_prepare($sender, $reci
   
   $plaintext = $plaintext || variable_get('mimemail_textonly', 0);
   $sender    = mimemail_address($sender);
-  $mail      = mimemail_html_body(theme('mimemail_message', $body, $mailkey), $subject, $plaintext, $text, $attachments);
+  $body      = theme('mimemail_message', $body);
+  $mail      = mimemail_html_body($body, $subject, $plaintext, $text, $attachments);
+  if (! is_array($headers)) {
+    $headers = array();
+  }
   $headers   = array_merge($headers, $mail['headers']);
   $message   = array(
     'address' => mimemail_address($recipient),

I have not used them since I planned to make a clean update and had no intention to solve any outstanding issues.

I was not aware of #257249. Your solution will surely prevent the error from occurring. But the problem lies in the fact that $headers is not an array, so somehow mimemail_headers() and mimemail_prepare() are called with a wrong value. I believe the effort should be focused on the cause not on the symptoms.

Sutharsan’s picture

FileSize
24.71 KB

Few additional changes:
* missing parameter in mimemail_theme() definition of mimemail_message
* checks for absent $message parameters in drupal_mail_wrapper()
* syntax error in watchdog() call (by LUTi: #259821 #1)

LUTi’s picture

Sutharsan,

thank you again for your efforts with this module. Things are getting better and better with simplenews / mimemail, at least at my test site. If it would only be the same with some other (important) modules...

Generally, I agree that we have to deal with the causes, not the consequences. The problems appear if causes are coming from where we have no impact, or at least not 100% is under our control.

In complex solutions (as Drupal is turning into more and more), we must expect from time to time to get something not exactly as it shall be (when we improve our part, the others do the same with their, and there are - normal and expected - periods when not everything is matched perfectly...), simply to have certain level of robustness.

If everything is under our control, I absolutely agree to skip unnecessary tasks, to release the system (and, improve the performance) as much as possible.

I believe additional checks generally don't hurt, at least as long as they don't have dramatical influence to the performance. Of course, "else" cases are missing in solutions above (to log somewhere that we've received something unexpected, so such situations are caught and reasons examined / corrected...). But still, this way, at least the error mesages are not popping out, what really doesn't look nice...

Magnus’s picture

After I applied mimemail.upgrade02.patch I got this error:
Fatal error: Cannot redeclare drupal_mail_wrapper() (previously declared in D:\www\sites\all\modules\mimemail\mimemail.module:306) in D:\www\sites\all\modules\smtp\smtp.module on line 306

I used the SMTP module in http://drupal.org/node/214975#comment-830810

LUTi’s picture

I see a check in this patch provided here:

 if (strpos(variable_get('smtp_library', ''), 'mimemail')
   && !function_exists('drupal_mail_wrapper')) {
 
-  function drupal_mail_wrapper($mailkey, $to, $subject, $body, $from, $headers) {
+  function drupal_mail_wrapper(&$message) {
+    $to = $message['to'];
+    $from = $message['from'];
+    $subject = $message['subject'];
+    $body = $message['body'];
+    $headers = isset($message['headers']) ? $message['headers'] : array();
+    $mailkey = isset($message['mailkey']) ? $message['mailkey'] : '';
     return mimemail($from, $to, $subject, $body, NULL, $headers, NULL, array(), $mailkey);
   }
-} 
+}

Probably, the same test should be performed in SMTP module before declaring the function, or? Even if I would expect the functions drupal_whatever() to be declared somewhere in core, and here mimemail_mail_wrapper() and in SMTP module smtp_mail_wrapper() would be used...

By the way, is the function declared here and in SMTP module more or less the same or not even that?

Sutharsan’s picture

drupal_mail_wrapper() is declared by the backend module. But Drupal allows only *one* backend which is determined by the 'smtp_library' variable. Using this mechanism makes it (unfortunately) impossible to first build an HTML mail with Mimemail and then send it via an external mailserver using smtp module.

LUTi’s picture

It seems to me that SMTP module has mainly be used when SMTP authentication is required (by SMTP server). Mime Mail is probably not able to handle that, or?

So, it would be great by my opinion if a sort of pipelining would be possible (to pass a mail to some other module instead of mailer)...

I am sorry if I write something stupid here, but I am not very familiar with Drupal backgrounds. Everything written here are just ideas from users point of view, in terms of usability (suitability to different situations / needs)...

Drupal Centric’s picture

I've manually patched my mime module, info and inc. files, uploaded them and installed without problem, set in Admin to send html emails but when I send a newsletter no html styles come across? I'm not getting any errors, just no formatted email?! If someone would like to send me a patched module I'll certainly try it plus I have a list of 3,000+ to send a mail to so it should be a good test for Drupal 6 versions of Simplenews and Mimemail :)

LUTi’s picture

Dickster,

if you are speaking about simplenews newslatter, there is a simplenews_code_mimemailcron.patch (originally posted in #248287: HTML mails not sent out properly issue).

For me, this patch seemed to resolve the issue...

Drupal Centric’s picture

Thanks Luti but the patch you suggested didn't work for me. When I send a test mail it borrows partial CSS styles (header and footer blue line) but no H1/H2 styles, <img src> or paragraph breaks work, only <strong> seems to work?! When I send an actual newsletter via cron no styles what so ever come through? Most odd, any ideas? Using Drupal 6.1.

Sutharsan’s picture

Assigned: Sutharsan » Unassigned

I published a patch for simplenews (http://drupal.org/node/248287#comment-867924) to make it compatible with the above #16 patch. But futher developement of HTML for simplenews have to wait until a Drupal 6 compatible version of Mime Mail is available.

Drupal Centric’s picture

Tried all the patches but it's not quite working, as above but now emails sent via cron match the test emails. Odd! Guess I'll have to wait for the official releases. Thanks Sutharsan.

cedrix’s picture

Man, now what? Is the mimemail now working with drupal 6.2 or is this waste of time?

Alternatively: is there any solution to send html-mails with 6.2?

Any help is highly appreciated.

Ced

Drupal Centric’s picture

Upgraded my Drupal to 6.2 and used all patches provided but couldn't get it to work. Using some freeware from Version Tracker at the moment as a stop gap.

cedrix’s picture

just used mimemail-6-alpha, simplenews-6.x.1.0-beta1 applied to above patch and I got it working to send out html-mails.

BUT #1; The mimemail is not sending out any embedded images. Also, referenced images (img src=http://yourdomain/image.jpg) are ignored (which are normally not ignored).

BUT #2: I get errors now when sending newsletters. Like this:

warning: file_get_contents(modules/aggregator/aggregator.css?Y) [function.file-get-contents]: failed to open stream: No such file or directory in /opt/lampp/htdocs/drupal/modules/mimemail/mimemail.module on line 455.
warning: file_get_contents(modules/cck/theme/content.css?Y) [function.file-get-contents]: failed to open stream: No such file or directory in /opt/lampp/htdocs/drupal/modules/mimemail/mimemail.module on line 455.
warning: file_get_contents(modules/cck/modules/fieldgroup/fieldgroup.css?Y) [function.file-get-contents]: failed to open stream: No such file or directory in /opt/lampp/htdocs/drupal/modules/mimemail/mimemail.module on line 455.
warning: file_get_contents(modules/fckeditor/fckeditor.css?Y) [function.file-get-contents]: failed to open stream: No such file or directory in /opt/lampp/htdocs/drupal/modules/mimemail/mimemail.module on line 455.
warning: file_get_contents(modules/node/node.css?Y) [function.file-get-contents]: failed to open stream: No such file or directory in /opt/lampp/htdocs/drupal/modules/mimemail/mimemail.module on line 455.
warning: file_get_contents(modules/system/defaults.css?Y) [function.file-get-contents]: failed to open stream: No such file or directory in /opt/lampp/htdocs/drupal/modules/mimemail/mimemail.module on line 455.
warning: file_get_contents(modules/system/system.css?Y) [function.file-get-contents]: failed to open stream: No such file or directory in /opt/lampp/htdocs/drupal/modules/mimemail/mimemail.module on line 455.
warning: file_get_contents(modules/system/system-menus.css?Y) [function.file-get-contents]: failed to open stream: No such file or directory in /opt/lampp/htdocs/drupal/modules/mimemail/mimemail.module on line 455.
warning: file_get_contents(modules/user/user.css?Y) [function.file-get-contents]: failed to open stream: No such file or directory in /opt/lampp/htdocs/drupal/modules/mimemail/mimemail.module on line 455.
warning: file_get_contents(sites/all/modules/simplenews/simplenews.css?Y) [function.file-get-contents]: failed to open stream: No such file or directory in /opt/lampp/htdocs/drupal/modules/mimemail/mimemail.module on line 455.
warning: file_get_contents(themes/pixture/style.css?Y) [function.file-get-contents]: failed to open stream: No such file or directory in /opt/lampp/htdocs/drupal/modules/mimemail/mimemail.module on line 455.

I stored
simplenews in /drupal/sites/all/modules/
and
mimemail in /drupal/modules/

If i copy simplenews to /drupal/modules it's not working any longer.

All this patchin', trying and so on is making "confusing" a too gentle word for this mess.

cedrix’s picture

I got it working now. Patch mimemail so the function looks like this:
It embeds images now correctly (inline, bas64 encoded)

<?php
function _mimemail_file($file = NULL, $type = '', $disposition = 'related') {
  static $files = array();

  // Added the following 3 lines (see node/114312 #13)
  if ($file == '.' ) {
      $file = NULL;
  }
  // Added the following 3 lines (see node/114312 #3)
  if ($file[0] == '/') { // convert absolute uri to relative path
    $file = substr($file, strlen(base_path()));
  }
  if ($file && !preg_match('@://|mailto:@', $file) && file_exists($file)) {
    $content_id = md5($file) .'@'. $_SERVER['HTTP_HOST'];

    $new_file = array('name' => substr($file, strrpos($file, '/') + 1),
                      'file' => $file,
                      'Content-ID' => $content_id,
                      'Content-Disposition' => $disposition,
                     );
    $new_file['Content-Type'] = _mimemail_mimetype($file,$type);

    $files[] = $new_file;

    return 'cid:'. $content_id;
  }

  if ($file) {
    return $file;
  }

  $ret = $files;
  $files = array();
  return $ret;
}
?>

regards

Ced

cedrix’s picture

Self-Solution: (after 6 hours of try-n-error, debugging and base64decoding)

The true problem was: Why does mimemail tries out 10 or more style-sheets for sending one mail?
and also: How to remove the "file not found"-errors as mentioned above.

Create a file named "mail.css" to "drupal/modules/mimemail/"-directory and place your mail css-styles in there.

Among lesser file-not-found-errors this also makes smaller sized emails.

These styles are being used on default (need to be defined in your .css-file):

div mimemail-body
div center
div main
class rteleft

Regards

Cedrix

STNyborg’s picture

I got "Lost in translation"...

After reading through all 31 previous comments I still have to figure out: is mimemail working well with 6.2 and if so with what patched patch? I have no experience with working with patches as I do not have direct access to the core of my Drupal installation, thus I don't know if I can use patches at all - can I?

If everything is working in 6.2 what will it take to launch a true 6.x version of Mimemail?

Regards,

Svend

cedrix’s picture

The alpha version is working in 6.x, but you need the mimemail-patch from above and (in case you want to embed images in your mails) the #30 edited-function.
Also put a mail.css in your mimemail-directory.

I've attached a mimemail-version which I'm using with all patches applied.

Hope this helps

Cedrix

NaheemSays’s picture

Can you please re attach that file?

cedrix’s picture

here we go again.

(I also put it on my website at: http://www.cedrix.de/images/mimemail-6-alpha1-patched.tgz so you can download it from here, too)

HTH

Cedrix

Edit: I attached it correctly, but it does appear here. Dont know why. Use above dl-link for your pleasure.

Magnus’s picture

cedrix, I tried your patched version but I still get the same error with SMTP module as in comment #18. When I save the settings in Mime Mail I get this error:
Fatal error: Cannot redeclare drupal_mail_wrapper() (previously declared in \sites\all\modules\mimemail\mimemail.module:333) in \sites\all\modules\smtp\smtp.module on line 306.

Sutharsan mentioned the problem in comment #20.

cedrix’s picture

The patched version is directly from my (working) server. Maybe it's a conflict or problem in your smtp.module?

Magnus’s picture

cedrix: Do you use SMTP module with Mime Mail?

cedrix’s picture

I'm using simplenews 6.x-1.0-beta1 for Newsletters. It works ok in combination with mimemail, no bugs so far. But I struggled a bit to install that one. I'll offer you mine backup plus instructions if you are in need. Let me know.

aries’s picture

Hi, I downloaded the mimemail-6-alpha1-patched.tgz and I got the "Unable to send e-mail. Please contact the site admin, if the problem persists." error message. There's no other mail alter stuff and the drupal 6.2 is vanilla. I echoed the variables in the drupal_mail_send() and everything seems ok... strange. Can someone confirm this?

Nick Lapp’s picture

Subscribing.

cedrix’s picture

Allie Micka’s picture

That wasn't very constructive, was it?

deekayen’s picture

@cedrix: Projects don't get deleted. Mimemail isn't going anywhere, even if it doesn't get a 6.x port.

There are enough modules that are duplicates of existing functionality, so instead of making yet another copy module and confusing people as to which one to use, just fix the patches for this one. Nobody's going to think you're a hero for re-inventing the wheel.

cedrix’s picture

The latest Mimemail converts now tags like A, H1, H2 HTML-Mail against all rules to:
=====JO====== and
------blabla------

Even when the options are set to send HTML-Mail (always) and the user accepts HTML-Mails, tool.

To be specific: the newly "updated" D6-Version is less than alpha and everyone should be warned. I spend the last two days on these issues.


UPDATE: When you set mimemail to use HTML on all mail it filters your HTML-Tags!!

So these are the instructions to make D6 work with Simplenews and mimemail:

-Use the patched version from my site

-Switch off "use always html-format" in mimemail!!!

-the image-tags should be:
<img src="/myimage.jpg"> this image will be base64-converted and embedded only if it is available. The root-directory is either
your drupal-root-directory or your drupal/sites/yoursite.com/-directory.

This is the patched versions-archive which is tested and works fine for me. For people who are interested in using the stuff, I make them available for the community. Just grab them here:
http://test.cedrix.com/mimemail-simplenews

HTH!!

Cedrix

angsikod’s picture

I installed the mimemail. But my emails are all plain text. Any advise?

cedrix’s picture

One last hint: You'd better use absolute-path within your image-tags.
img src=/somepicture.gif
will always be embedded from your www-root/drupal-directory. (e.g. /var/www/drupal/somepicture.gif)

The "/" is necessary, because the image can not be found by different modules if it's relative. (e.g four different relatives: your start-page, the list/page of newsletter-content, the embedded image in newsletter-mail, image preview of fck-editor... etc).

To avoid long pathnames, I created a symbolic link in my drupal-root:
ln sites/<mysitename.com>/files msf -f
(msf=mysite-files or whatever you prefer)

So that my image-tags are always like:
img src=/msf/image/thisworksalwaysright.jpg

Also: The mails have images embedded 100% correct AND: (tataaa) There is no false "Attachment"-symbol when sending html-mails as it was before!!

I spent hours on finding a proper way through this and hope that this is helpful for others.

Ced

mbroaddus’s picture

Using Drupal version 6.2. I've tried the patched mime mail from post #35 with Simple News Beta 1 and Beta 2. I've checked and unchecked "Use mime mail for all messages" and nothing seems to work. My mail is sent, but it is always in plain text.

On post #45, there is said to be a patched version here: http://test.cedrix.com/mimemail-simplenews...But I can't find it.

I'm not using the SMTP module.

I get no errors, I'm not even sure mime mail is doing anything or how to test it.

Does anyone have a suggestion, or should I just wait it out until there is an official Drupal 6.2 mime mail version?

Thanks

cedrix’s picture

The attach on test.cedrix.com only came up for registered users! Sorry for that!!! It fixed it and it can be leeched now directly!!

HTH

Cedrix

dbaasi’s picture

Regarding your patch on #35, Just an FYI, my return-path would not work until I changed the period to a comma on
mimemail_rfc_headers($message['headers']) . $returnpath_string

cedrix’s picture

@dbaasi: dunno. Sounds like a localization issue.

hosais’s picture

could anyone tell me where is "use always html-format" in mime mail?

I cannot find the place. Thank you very much.

Note: The only things I have in Mime Mail is :

Mime Mail
E-mail address:
A valid e-mail address for this website, used by the auto-mailer during registration, new password requests, notifications, etc.

Use mime mail for all messages

Use the mime mail module to deliver all site messages. With this option, system emails will have styles and formatting

Plaintext email only ...

hosais’s picture

Hi,

Cedrix, thanks for the efforts.

I installed the Mime Mail module, but the mail is still plantxt.

May I ask what do you mean by "-Switch off "use always html-format" in mimemail!!!" at #45.

I cannot find this on the settings of mimemail.

Thanks.

Joesph Lee

cedrix’s picture

In /admin/settings/mimemail there's a "use mime mail for all messages".

When activated it sends html mail, but filters some tags (e.g. H1, IMG). So I turned that switch off and the tags dont get filtered.

Do you use simplenews, too? There should be an option to send "plain" or "html"-format. Activate html there.

HTH

Ced

mbroaddus’s picture

I've installed as you specified and it works perfect.

Thanks

physiotek’s picture

When activated it sends html mail, but filters some tags (e.g. H1, IMG). So I turned that switch off and the tags dont get filtered.

but where do i switch that filter off ??? i dont see any of this in the mime mail settings..
pht3k

physiotek’s picture

sorry forget about my last post.
everything is working fine now...
thanks!

tomamic’s picture

I'm not able to make these patches work, even using precisely the suggested settings...
Anyway, in #45 there's a function which is PHP5-only:

$dings=scandir(".");

It can be easily replaced by:

$dh = opendir('.');
while (false !== ($filename = readdir($dh))) {
    $dings[] = $filename;
}
thomas23@drupal.org’s picture

Basically I'm subscribing here.

But I'd be happy to see a checked-in package version, i.e. mimemail-6.x-dev.tar.gz sort of thing, in order to use mime mail for simplenews.

Cheers.

kenmaples’s picture

I am also watching for this to be posted...I hope it will be here soon!

hosais’s picture

Thanks for Ced's help #54.

I finally have time to get this work (with html email) through downgrade the simplenews to beta 1.

I switch off "use mime mail for all messages", but some tags are still missing (well, the image is still there). If you or anyone knows where is the code, I could really appreciate if you oculd tell me where it is so that I can let it ignore the tags.

By the way, in the bottom of the mail, there is a string :"jajasites/all/modules/mimemail/mail.cssund:sites/all/modules/mimemail". Is this normal?

Also, the theme does not put into the mail. Is it because my web site is 6.x?

Thanks again.

matthewbot’s picture

hosais, if you haven't found it yet, the "jaja" would appear to be some forgotten debugging code in mimemail.module lines 451 to 454, I deleted them and it went away.

thomas23@drupal.org’s picture

Title: Upgrade to Drupal 6 » Upgrade Mime Mail to Drupal 6
ddanier’s picture

subscribing

zmove’s picture

Hi,

Is there any news about the drupal 6 port ? because the first patch have 8 month old and no news about an eventual d6 port...

It is planned or will we never see an after 5.x version of that module ?

thanks

zmove

Allie Micka’s picture

I'll want to carve out time to address any critical bugs and/or support issues on the 5 branch before this is a priority. If you're interested in helping with that, please see if we can't close some other issues on this project.

Thanks!

oshaly’s picture

subscribe

bloke_zero’s picture

Subscribing

neliason’s picture

Subscribing

hosais’s picture

Thanks for the help.

I decide to give up simplenews/mimemail in drupal 6.x for now because

1)Some tag in the my newsletter will be removed.
2)The complicated situation with simplenews without clear version control.

I build a scribe block in my drupal 6.x system now but actually connecting to the drupal 5.x. I installed a durpal 5 in the same host with the same domain only for this purpose. To the web user, this is transparant.

Hope this would be helpful to people who need the functionality right a way.

To the end of course, I still look forward to see this module on drupal 6.x.

Hosais.

matthewbot’s picture

FileSize
7.38 KB

I'm not giving up quite yet! I've built a 6.x site with cedrix's modified versions, but we need to centralize efforts back into version control. And the first step needs to be to create a Mime Mail 6.x branch. I updated the #16 patch to apply to HEAD. The only change I made to Sutharsan's patch was to remove the mimemail_mail_alter() function, see #215310: stripped html tags from body, and #260148: Remove mimemail_mail_alter(). This is probably not the right thing to do, as that code must be doing something, but passing stuff through whatever the site's default filter happens to be is not the way to do it. Hopefully further testing will reveal regression(s), if any. With this and a patch I've made against Simplenews HEAD, I've been able to put out simple HTML newsletters. I'll be testing things like CSS and images shortly.

This is my first time making patches and doing drupal development, so let me know if I've messed something up. Also, what else needs to be done to start an official 6.x branch for Mimemail? Perhaps #258026: Rip out html_to_text code and depend on http://drupal.org/project/html_to_text? If the plan is really just to replace mimemail_html_to_text() with drupal_html_to_text(), I could easily add that to my patch.

Allie Micka’s picture

Thanks, matthewbot!

The patch is really nice, but please stick to one issue at a time. We'll be addressing any common issues in D5 ( formatting, mail_alter, html_to_text(), mail composition/mime issues ) *before* this module is updated to D6, and at that point, this patch won't apply anymore.

Meanwhile, if you make it an upgrade-only patch, people can still use it on their D6 sites even if they haven't got the time or inclination to help the other issues along.

Thanks again,

Allie

matthewbot’s picture

FileSize
3.28 KB

Ok! Here's an upgrade-only patch. I understand a bit better what you mean now, in theory as HEAD gets fixed this extremely simple patch should still apply so anyone who needs D6 immediately can just apply it. Should I now take the code changes I got from #16 and make them as a separate patch against 5.x?

bloke_zero’s picture

re: #73

Hi matthewbot,

When I apply this patch to the official release mime mail 5.x-1.0 using terminal in os x I get:

patching file mimemail.inc
Hunk #1 FAILED at 519.
1 out of 1 hunk FAILED -- saving rejects to file mimemail.inc.rej
patching file mimemail.info
Hunk #1 FAILED at 2.
1 out of 1 hunk FAILED -- saving rejects to file mimemail.info.rej
patching file mimemail.module
Hunk #2 succeeded at 286 with fuzz 1 (offset -59 lines).
Hunk #3 FAILED at 421.
1 out of 3 hunks FAILED -- saving rejects to file mimemail.module.rej

Am I patching the wrong file?

matthewbot’s picture

Yes, this should go against HEAD. There's a nice article in the handbook about how to check it out using cvs. That patch is now an upgrade only patch, and won't fix any of the current issues that exist in HEAD. Specifically, you should still run in to #215310: stripped html tags from body, if your site's default format filter is filtering HTML tags. You can either change the default format to "Full HTML", or comment out the line described in that issue.

bloke_zero’s picture

Thanks for the info matthewbot. That made the diff.

Allie Micka’s picture

I have backported the HEAD changes to the DRUPAL-5 branch, so when the dev release gets updated you can use that instead of mucking with CVS.

jweberg’s picture

Subscribing!

philprism’s picture

I have the following setup on Drupal 6.1

Mime Mail 6.x-alpha-1
Simplenews 6.x-1.0-beta3 Depends on: Taxonomy (enabled)
Required by: Simplenews action (enabled)
Simplenews action 6.x-1.0-beta3 Depends on: Simplenews (enabled), Taxonomy (enabled)

1. After reading the posts I cant figure out which are the right patches to apply and then apply them, I am setting up the dev environment with easyecllipse.

2. Does anyone have just have the straight code for patched simplenews and/or mimemail modules to get the HTML working?

Answers or help with either would be great.

matthewbot’s picture

I'd really suggest just switching to d5. I haven't kept my patches up to date and tested with the changes just put into Mimemail, and I haven't been following Simplenews at all. Here's what I've got, it might still work, I don't know at the moment.

1. Check out the HEAD release from CVS. A lot of bugfixes just went in, so I think you'll be less likely to run into issues.
2. Apply my patch in #75 to make it compatible with 6.x
3. See if the latest Simplenews 6.x works out of the box.
4. If you run into issues, try applying my Simplenews patch to Simplenews HEAD, which you can get through CVS. I'm not even sure it will apply anymore though. It also doesn't account for the fact that mimemail now calls mail_alter hooks on its own. Simplenews calls them explicitly, so the net effect is that they will currently run twice.

If you try all of the above, please let me know of any issues. I may be able to get a Mimemail + Simplenews 6.x patch set that works uploaded on Sunday, but I may not have time until next weekend.

philprism’s picture

Thanks for the pointers, really appreciated

I am making gradual progress with PHP eclipse so I understand what you say about CVS.

The simplenews/mimemail version I am using sends through text so its 'trying'.

I will let you know how I get on

pillarsdotnet’s picture

FileSize
2.99 KB

Rerolled patch against current cvs HEAD checkout

matthewbot’s picture

Thats a good start, but you've removed some filtering code that we added as part of the fix to #215310: stripped html tags from body in drupal_mail_wrapper. I might get a chance to reroll and test soon, but if you'd like to fix up your patch that help would be appreciated.

matthewbot’s picture

New reroll needs to wait until #215310: stripped html tags from body gets fixed in HEAD.

andrewko’s picture

subscribing

3CWebDev’s picture

subscribing

chrissearle’s picture

subscribe

rj’s picture

subscribe

anibalardid’s picture

subscribe ...

rimu’s picture

subscribe

mariuss’s picture

subscribe

thierry.beeckmans’s picture

Title: Upgrade Mime Mail to Drupal 6 » Is this re-roll planned by someone?

Is this re-roll planned by someone? It's marked as 'Unassigned'

I'm looking forward to test this re-rolled patch ;)

subscribing :)

chrissearle’s picture

Title: Is this re-roll planned by someone? » Upgrade Mime Mail to Drupal 6
Setzler’s picture

Subscribed.

Setzler’s picture

Broken links are bad. Where is it now?

pillarsdotnet’s picture

Re-rolled against current cvs HEAD checkout, which already includes fix in #215310: stripped html tags from body.

slosa’s picture

subscribing

duntuk’s picture

subscribing

LUTi’s picture

#96 patch doesn't work well:
- there are error messages (due to a changed drupal_mail_wrapper function call)
- mail sent contains only text n/a; changing check_markup($body, $format) to check_markup($message['body'], $format) makes message being sent as HTML, but without expected (proper) formatting

#82 patch however seems to work quite well for me - HTML messages are sent out as I expect them to be, plain text messages are missing line breaks "only"...

tech108’s picture

subscribe

appel’s picture

subscribing as well.

AlexisWilke’s picture

FileSize
13.72 KB

FYI, I installed the CVS version and applied the latest patch available in this issue and it worked on my site http://alexis.m2osw.com/animals/

I think it would be nice to have a tarball ready to do so, would be neat 8-). Well... I'm attaching my version.

Otherwise, simplenews accepted your module as is and sent a couple entries and I had no issue on the site.

I still need to confirm that the email is indeed in valid HTML, etc. but I'd bet it will be.

One thing that may be considered missing, btw: I do not see anything in the hook_uninstall() to remove the tables created by the installer. Should we not delete the simplenews_* tables if someone wants to uninstall that module? It will destroy the list of subscribers, among other things, but well...

Thank you for the great module!
Alexis Wilke

Garrett Albright’s picture

AlexisWilke, no, I do not think it's a good idea for the Mime Mail module to remove Simplenews's tables… Mime Mail does not seem to create any of its own tables, so I think its hook_uninstall() is dandy as it is.

Thanks for your tarball, though. I'm just about to try it out myself.

EDIT: Doesn't seem to work. The messages I'm receiving seem to be sanitized much like the messages from d.o and g.d.o; text with the <em> tag is offset by /slashes,/ links are formatted like this [1], etc. Maybe it's something on my end, though. I'll keep playing with it.

[1] http://example.com/

thelocaltourist’s picture

subscribing

waues’s picture

#102
Thanks for the package but it doesn't work for me.

I have latest drupal 6 installed. I can preview the html newsletter well, but sent mail is not in correct form.

Garrett Albright’s picture

Duh, I think I figured out the problem. Simplenews and Mime Mail are not getting along because Simplenews for D6 is not trying to send messages out through Mime Mail. It's kind of frustrating that Simplenews D6 would acknowledge Mime Mail D6's presence in other ways, but wouldn't actually use it to send messages, but seeing as how Mime Mail D6 doesn't really officially exist at this point, I guess it's not too surprising.

I'll try to patch Simplenews D6 to use Mime Mail again, but since I'm not too familiar with the workings of either module, I'm not sure how good a job I'll do. I'll post a patch in the Simplenews issue queue if I get something working acceptably.

Garrett Albright’s picture

Okay, the patch for Simplenews is in this issue. (Use the patch in the first comment; I messed up on the one in the actual issue node.)

waues’s picture

FileSize
126 KB

Garrett, I installed your latest simplenews-mimemail.patch, it worked! The HTML mail displayed correctly until now.

One question, are you using #102 AlexisWilke 's mimemail package? Because I got a bunch of the errors which you can see in the attachment.

Any suggestions would be appreciated.

vlooivlerke’s picture

Hi I used the latest Simple news Dev version (sep 8) and used the patch.
Cool it works, but that mile long error when the cron is run, :P
I can confirm the screen shot error, and it looks like it cant fetch the style sheet from my theme

Line:504

I did create a mail.css file and placed it in my themes directory but no luck.

Other than that, this module does its job. I tested pics and allowed html tags and they all work :)
Thanks, great stuff

Garrett Albright’s picture

Yes, that error happens for me too (yes, I am using the code in #102). But since that's a problem with Mime Mail and not with Simplenews (AFAICT), the Simplenews patch neither caused it nor can fix it. Perhaps I'll release another patch for Mime Mail fixing that problem later.

larsdesigns’s picture

When will the Drupal 6 version of Mime Mail be released? Is anyone working on it officially?

NaheemSays’s picture

Tested the version of Mime mail in comment 102 witht he patch in simplenews queue and it mostly works.

The only issue is the lack of separation between paragraphs. No idea if that is an issue here or simplenews or Drupal itself.

thomas23@drupal.org’s picture

Here I have the same issue that paragraphs are not separated without using any of these patches. I'm using plain D6 simplemail. I'd be happy to track this down if someone could give me a hint on where to start.

Cheers.

keuvain33’s picture

I have the same problem.

keuvain33’s picture

Hi,

Do you find an issue to this problem? I have the same errors when I validated my newsletter.

Garrett Albright’s picture

Hmm, looks like this is indeed a problem. Mime Mail seems to be converting paragraph breaks to line breaks for some reason. I'll see if I can track down a cause.

EDIT: Are those of you who are having this problem using the "Full HTML" input format? I'm not having this problem when I use that format. This doesn't seem to be Mime Mail's problem.

NaheemSays’s picture

I was using filtered (with a few other bits and bobs thrown in such as img_assist, smileys, bbcode etc etc into one "uberfilter").

afaik, filtered does strip paragraph tags, so that may be the problem. is there a way for MimeMail to work around that, or would a different filter need to be used?

NaheemSays’s picture

Status: Needs review » Reviewed & tested by the community

Since that is (most likely) a separate issue, marking as rtbc

Garrett Albright’s picture

nbz, just add the <p> tag to the list of allowed tags. Go to Administer > Site configuration > Input formats, and click "Configure" in the "Operations" column of the "Filtered HTML" row. Then click the "Configure" tab at the top. (Yep, you have to click two separate "Configures.") On the next page, find the "HTML filter" section and add "<p>" to the "Allowed HTML tags" field. Then click "Save configuration."

…Come to think of it, if you have the "Line break converter" filter in the "Filtered HTML" input format (it's there by default), this problem shouldn't be happening, so maybe there's something else going on here… So please try the above, then come back here and let us know the result.

NaheemSays’s picture

Yeah, the second bit. The <p> should be added automatically.

I would hazard that the problem is with simplenews, not mimemail as sending plain text messages also leaves no space between paragraphs.

Garrett Albright’s picture

But then why does the problem go away when Full HTML is selected? Hmm.

I'll look into it.

thomas23@drupal.org’s picture

The paragraph issue is with simplenews since I don't have mime mail installed just yet.

I opened an issue over there #306670: Simplenews ignores paragraphes on some installations. Hope to have more time soon to give more details from my end. I do recall, though, to have tested all the full html filter stuff to no eval.

Please correct/add version and other issue info over there.

Cheers.

Garrett Albright’s picture

Okay, I think I found the problem.

Before Simplenews (both with my patch and without) sends a message, it passes it to drupal_mail(), which calls all hook_mail_alter() implementations on the message. The message is then passed to Mime Mail via the mimemail() function, which is also, in its own D5-compatible way, calling all hook_mail_alter() implementations on the message. It's being double-filtered, I think.

So that's the problem. What's the sanest solution? Still investigating…

EDIT: Hmm. While the double-callage is a problem, it does not seem to be the cause of this problem.

Garrett Albright’s picture

Okay, I've added a patch for Simplenews to thomas's issue which solves the line break problem.

Now to work on the hook_mail_alter double-callage problem I found on the way.

Garrett Albright’s picture

FileSize
913 bytes

Okay. To solve the hook_mail_alter() problem, I finally decided the best solution is to simply remove that part of the code from the D6 version of Mime Mail, and insist that all D6 modules sending mail through Mime Mail call the hooks themselves, either by calling drupal_mail() (as my patch to Simplenews does) or by some other way. I don't know if the original contributor(s) to Mime Mail will agree with this solution, but it seems to be the simplest way to solve this problem that I can determine. Here's a patch to use against the code in #102 to implement this. If you're using my Simplenews patch, I highly recommend you use this patch as well.

I'm about to post an update to the Simplenews patch, by the way.

Liberation’s picture

subscribe

philprism’s picture

Hi all,

I have

* Drupal 6.4
* mimemail from comment #102 mimemail-6.x-0.9.tar_.gz
* Simplenews 6.x-1.0-beta3
* /drupal/includes/mail.inc (drupal 6.4) // $Id: mail.inc,v 1.8.2.3 2008/05/19 08:19:00 goba Exp $

When I add a new user or send a newsletter with an attachment with mimemail enabled I get the following error messages

* warning: Missing argument 2 for drupal_mail_wrapper(), called in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/includes/mail.inc on line 177 and defined in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 361.
* warning: Missing argument 3 for drupal_mail_wrapper(), called in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/includes/mail.inc on line 177 and defined in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 361.
* warning: Missing argument 4 for drupal_mail_wrapper(), called in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/includes/mail.inc on line 177 and defined in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 361.
* warning: Missing argument 5 for drupal_mail_wrapper(), called in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/includes/mail.inc on line 177 and defined in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 361.
* warning: Missing argument 6 for drupal_mail_wrapper(), called in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/includes/mail.inc on line 177 and defined in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 361.
* warning: file_get_contents() [function.file-get-contents]: Unable to access
in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.
* warning: file_get_contents(
) [function.file-get-contents]: failed to open stream: Success in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.
* warning: file_get_contents() [function.file-get-contents]: Unable to access
in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.
* warning: file_get_contents(
) [function.file-get-contents]: failed to open stream: Success in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.
* warning: file_get_contents() [function.file-get-contents]: Unable to access
in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.
* warning: file_get_contents(
) [function.file-get-contents]: failed to open stream: Success in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.
* warning: file_get_contents() [function.file-get-contents]: Unable to access
in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.
* warning: file_get_contents(
) [function.file-get-contents]: failed to open stream: Success in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.
* warning: file_get_contents() [function.file-get-contents]: Unable to access
in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.
* warning: file_get_contents(
) [function.file-get-contents]: failed to open stream: Success in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.
* warning: file_get_contents() [function.file-get-contents]: Unable to access
in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.
* warning: file_get_contents(
) [function.file-get-contents]: failed to open stream: Success in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.
* warning: file_get_contents() [function.file-get-contents]: Unable to access
in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.
* warning: file_get_contents(
) [function.file-get-contents]: failed to open stream: Success in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.
* warning: file_get_contents() [function.file-get-contents]: Unable to access
in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.
* warning: file_get_contents(
) [function.file-get-contents]: failed to open stream: Success in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.
* warning: file_get_contents() [function.file-get-contents]: Unable to access
in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.
* warning: file_get_contents(
) [function.file-get-contents]: failed to open stream: Success in /var/www/vhosts/ashburtonartgallery.org.nz/httpdocs/drupal/sites/all/modules/mimemail/mimemail.module on line 504.

Does anyone have an explanation or solution? There seems to be more going on here than simplenews/mimemail compatability. Am I right in thinking the mail.inc file in the first line is a core module include file?

I would like to do something other than disable the mimemail module.

Thanks
Phil

Garrett Albright’s picture

The file_get_contents() errors are known bugs, but the drupal_mail_wrapper() one is new to me. Anyone else getting that?

Did your message(s) successfully send, regardless of the errors?

pillarsdotnet’s picture

Status: Reviewed & tested by the community » Needs review

The code in #102 is a fork, not a patch. I have reviewed the code and it *seems* to be consistent with the patch in #96 but other testers need to confirm before changing status to rtbc.

philprism’s picture

Hi Garret,

Yes the email got through in plain text with the activation hyperlink embedded I clicked on and it all went OK

Question: possibly connected

When the mimemail module is installed should it be placed in /drupal/modules or /sites.

I have placed mine in /sites

Garrett Albright’s picture

If by "/drupal/modules," you mean the "modules" directory at the root level of the Drupal installation, then no, non-core modules (modules that don't come with Drupal) should never be placed there. On the other hand, placing it only in the "sites" directory doesn't make any sense either. You probably want to place it in sites/all/modules - you may have to create that directory if it doesn't exist. But that's another issue.

pillarsdotnet’s picture

Finally got around to testing the patch. Found a bug; fixed it. The attached patches now work for me:

Drupal: 6.4
Simplenews: 6.x-1.x-dev plus attached patch
Mimemail: cvs HEAD plus attached patch

Garrett Albright’s picture

FileSize
61.7 KB

Your patch doesn't seem to have been created according to Drupal's guidelines. Also, I'm not sure what you patched against, because when I patch against this head, I get something quite a bit different. Attached is a patch against that head, including your bug fix, which I just copied over by hand. (You made the ugly "file not found" errors when newsletters are sent go away! Well done.)

Your Simplenews patch seems to not do anything different than my most recent patch for that, so I won't bother re-rolling that too.

pillarsdotnet’s picture

Re #133:

You patched against a CVS snapshot. I patched against a current CVS checkout. They're different. And yes. the simplenews patch was copied from your post on another issue; I found it more convenient to show both diffs in the same place rather than reference the other issue.

philprism’s picture

Hi Garret

It is in sites/all/modules

I have disabled mimemail, have you had any thoughts on what the error might be? or where I might start looking. I dont have version patching set up but if someone has a working version of simplenews in combination with mimemail at drupal level 6.4 I would be very happy.

pillarsdotnet’s picture

Steps to creating a working mimemail/simplenews combination at the drupal 6.4 level:

  1. cd /var/www/sites/all/modules
  2. rm -rf mimemail simplenews
  3. cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d mimemail contributions/modules/mimemail
  4. wget http://drupal.org/files/issues/mimemail-cvs-HEAD-to-v6-update.diff
  5. patch -d mimemail < mimemail-cvs-HEAD-to-v6-update.diff
  6. wget http://ftp.drupal.org/files/projects/simplenews-6.x-1.x-dev.tar.gz
  7. tar -zxf simplenews-6.x-1.x-dev.tar.gz
  8. wget http://drupal.org/files/issues/simplenews-6.x-1.x-dev-mimemail-fix.diff
  9. patch -d simplenews < simplenews-6.x-1.x-dev-mimemail-fix.diff
philprism’s picture

Status: Closed (fixed) » Needs review

Thanks, I have a windows installation and have installed the following successfully

http://www.wincvs.org/download.html

Latest Recommended Release: WinCvs 2.0.2.4 (released 2005-08-15)

http://www.python.org/download/

Python 2.5.2 Windows installer

(Windows binary -- does not include source)

Applied for CVS account at Drupal (Not necessary but did so anyway)

Steps 1,2,3 OK

Downloaded patch for windows from http://gnuwin32.sourceforge.net/packages/patch.htm zip file

Placed files in c:\utils\patch

Opened up a command window and moved to c:\utils\patch\bin

Executed the following command (C:\mimemail is where I stored the mimemail source localy)

C:\UTILS\PATCH\BIN>patch -d c:\mimemail < mimemail-cvs-HEAD-to-v6-update.diff

patching file mimemail.inc
patching file mimemail.info
patching file mimemail.module

Executed the following command (C:\simplenews is where i stored the simplenews tar source locally)

C:\UTILS\PATCH\BIN>patch -d c:\simplenews < simplenews-6.x-1.x-dev-mimemail-fix.diff

patching file simplenews.module

Seems to have worked so far, just installing patched versions. In progress............................ Dont reply just yet :-)

Just sent a newsletter correctly the web site didn't go splat

Hope this windows stuff helps the poor, lost and tormented souls who are trawling the binary sea for help!

This community support thing really works. Good on you

pillarsdotnet’s picture

Status: Needs review » Reviewed & tested by the community

The damn thing worked...

So.... can we set this to rtbc now ?

philprism’s picture

Hi pillarsdotnet,

In case #138 addressed to me

  • Tested several HTML newsletters and revisions successfully
  • Tested email events successfuly, accessing mimemail.
  • Checked logs, Drupal and system, for errors/warnings and found none

Good patch

Phil

abo_loai’s picture

hi Pillar.. ;
I followed all the steps but i am getting the error of Fatal error: Cannot redeclare drupal_mail_wrapper() ................ Was this error supposed to be fixed in the process you mentioned ?
Do i have to apply more patchs correctios to that ?
Thanks
J

Garrett Albright’s picture

For those of you having problems with drupal_mail_wrapper(), could you run this command in a shell and share the output with us?

grep -e 'drupal_mail_wrapper' -r /path/to/drupal

I suspect there is another module which you have enabled which is clobbering Mime Mail's definition of this function.

AlexisWilke’s picture

Hi Garrett,

I'm the #102, in case you remember... 8-)

I checked with your latest changes and got HTML in the email, but the message is not HTML at all. So that is partially good so far. I also get the long list of errors with calls to file_get_contents(). I know I have the

in both my filters and my HTML works in my pages, so my filters are setup properly. And the cool thing is I could setup a specific filter for emails. But anyway... looking a bit further, your hook_mail() calls simplenews_html_to_text() on the $body unconditionally. I guess you wanted to test something there...

I commented out that line and I now get my HTML and I'm a happy guy! 8-)

      in sites/all/modules/simplenews/simplenews.module around line 1329
      $variables =  user_mail_tokens($context['account'], $context['account']->language);
      $body = strtr($body, $variables);
      //$body = simplenews_html_to_text($body);
      $message['body']['body'] = $body;

In regard to the file_get_contents() error, it comes from the fact that the author of MimeType expects a list of filenames, but instead he gets a list of
tags. I added a preg_replace() that takes care of that, but I'm wondering whether a better call would be more logical here, you know, to directly get the list of filenames instead of a list of tags... (namely: $styles = drupal_add_css()--and then you can use a foreach() and get the theme name from the array. On the other hand, the drupal_get_css() function has logic that it not available in drupal_add_css() and would need to be duplicated in the mimemail code, not so good!)

  in "sites/all/modules/mimemail/mimemail.module" around line 454 (near the end of the file)
  if () {
    ... // this remains the same, but the author meant to have an else statement before the foreach()
        // at least according to the README.txt
  }
  else foreach (explode("\n", $styles) as $style) {
    $filename = preg_replace('|^.*href="' . base_path() . '([^"?]*)["?].*$|', '\1', $style);
    //$output .= ' /* Style from: ' . $filename . ' */ '; // to see what comes from where
    $output .= drupal_load_stylesheet($filename, TRUE);
  }

Otherwise, in the email I receive, there is a link to remove myself from the newsletter list but that does not work.

The link in the email is:

http://alexis.m2osw.com/animals/newsletter/confirm/remove/

when I think it should be:

http://alexis.m2osw.com/animals/newsletter/subscriptions

which does work. What do you think? And maybe having a ?email=blah would be good there so the email input field can be pre-filled. But that's a new feature 8-)

Thank you.
Alexis

P.S. I do not get the 'drupal_mail_wrapper' errors.

P.P.S. I could not install your latest patches without editing my files by hand, so I did not attempt to get a patch this time...

P.P.P.S. I did one last check to make sure, and I got that newsletter perfectly in the email! http://alexis.m2osw.com/animals/node/52

rookiedrup’s picture

Hi
I got the same problem as jalal when trying to turn on the smtp module. I guess the smtp and mimemail is using the same drupal_mail_wrapper().

Seemed like my installation of the simplenews and mimemail is unstable now. Not sure how to recover back.

Also, seemed like the simplenews patch in #136 to solve the problems here have some issues with simplenews register module for version 6. The simplenews register now does not work with the simplenews patch in #136. When the user subscribes to a newsletter during registration, the newsletter did not get subscribed. It was working before when I used the simplenews patch at http://drupal.org/node/261746#comment-980578.

Hope we can resolve these issues for version 6.x for these 3 modules of simplenews, mimemail and simplenews register soon. Thanks for all the great work.

Garrett Albright’s picture

Alexis: With regards to not getting HTML emails, it appears you did not properly patch Simplenews, since that section of code you quoted no longer exists in that form in the fully-patched version - it checks that you're trying to send a message in "plain" format before it calls simplenews_html_to_text(). But that's a Simplenews issue, so please bring it up in the Simplenews issue queue.

As for the CSS file-adding issues, the patches in #132/#133 will fix that.

For those having the drupal_mail_wrapper() issue… I wonder if tinkering with the weight values of the simplenews and mimemail rows in {system} will have any effect… Anyone out there having this problem who would know how to do that? (Be careful; {system} can be delicate…)

daniorama’s picture

If everythings works could someone post the patched versions of mime and simplenews? Thanks!

LUTi’s picture

DaniOrama, I am attaching the latest mimemail version which seems to work for me in combination with the latest development version of simplenews (6.x-1.x-dev -2008-Sep-20), patched of course (patch is also attached here). In mimemail archive, you can also find a fix which shall generally not be needed (SMTP Return Path fix I need in my system) - you can delete it (or, apply in case you need it as well).

jerdavis’s picture

Just checking in here. I'm getting started on the official upgrade this weekend and going over this thread to see what you all have been running into.

Our apologies for not getting around to this sooner. There were a few outstanding issues to take care of before we went ahead with a d6 upgrade and we were swamped with client work leading up to and following Drupalcon.

Hopefully we can get a dev release up this weekend.

Setzler’s picture

Wonderful!

jerdavis’s picture

Status: Reviewed & tested by the community » Fixed

Drupal 6 upgrade committed to HEAD! A new development snapshot should be available shortly on the module page. If you encounter any issues please report them in a new thread.

daniorama’s picture

LUTi, thank you very much!

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

Derekal’s picture

Does anyone know when the final mime mail release for Drupal 6 will be released? I don't know whether to wait or attempt to use what's been developed above and apply the patch.

Thanks!
T.

NaheemSays’s picture

The nightly from 6.x-1.x-dev from 21 September IS what has been developed above.

If it was not working for most users, I suspect there would have been more talk about that.

Use the noghtly, if you have problems, fille issues.

When the maintainer is sure the module is stable and has had enough testing, I am sure we will get a stable release.

mariuss’s picture

@Derekal, I have been using 6.x-1.x-dev from 21 September and works fine so far.

philprism’s picture

Title: Upgrade Mime Mail to Drupal 6 » Drupal 6.9 and rc4 upgrade
Status: Needs review » Closed (fixed)

I have upgraded to rc4 and Drupal 6.9 followed the install instructions, uninstalled the re-installed but I can only get plain text replacement chars where the formatting should be. Can anyone think what this could be?

  • Drupal 6.9
  • Mimemail 6.x-1.x-dev (2008-Sep-22)
  • Simplenews 6.x-1.0-rc4
  • Installed OK and ran update with no errors
  • Newsletter uses HTML (Full HTML)
  • Newsletter content type 'Newsletter'
  • mimemail set for all HTML messages (Full HTML)
  • Testing carried out as admin user
  • Created a newsletter issue using fckeditor, saved and displays OK.
  • Selected option to send one test newsletter
  • Email sent OK
  • Content arrives in plain text with hyphens/chars replacing HTML formatting
  • Hyperlinks are embedded in plain text OK
  • Ordered lists appearing with asterisks in front

e.g. sample output

-------- TESTING SIMPLENEWS - MIMEMAIL ---------------------------------------
 
-------- WHAT DO WE MEAN BY CONTENT MANAGEMENT? ------------------------------
 
Allows you to update the pages of your website whenever you feel like it.

Phil

LUTi’s picture

Phil, did you change the title of this issue? Congratulations... ;-)

By the way, I am not observing the problem you are describing. I am receiving normal HTML messages...

pillarsdotnet’s picture

hotmail (and possibly other web-based email providers) will show the text version by preference if both text and html parts are provided. This is a known issue; look at the queue and you'll see a patch pending.

philprism’s picture

Hi Luti,

Yes I did change it by mistake, apologies. no congratulations necessary.

I am not sure how to resolve this, my 6.8 and rc3 version was working, any suggestions?

Phil

eff_shaped’s picture

subscribing
Really, really need this to work with D6 on a live site.