In theme_mimemail_message a mail.css file added to your theme folder will not be loaded.

For some reason path_to_theme returns the mimemail module folder and not the theme folder. I found that the following code works:

global $theme;

$styles = drupal_get_path('theme', $theme) .'/mail.css';

This looks more like a bug with Drupal core, see #194098: path_to_theme() returns path to module that calls it, but the above code change will get things working.

Comments

DanGarthwaite’s picture

Still no love here.

The only way i could get rid of the theme's CSS was to comment out the whole if($style) block just below the drupal_get_path() / path_to_theme() call.

I _still_ can not get Drupal 6 + simplenews to send HTML!

geerlingguy’s picture

I was having so much trouble trying to get *only* mail.css to be included that I finally gave up and removed the whole section of code that calls for the other css files. My email messages went from being 52+ KB, to being 2 KB.

Anonymous’s picture

Assigned: Unassigned »
Status: Active » Needs review

Found the solution.

In the mimemail.module line 496 states:

$styles = path_to_theme() .'/mail.css';

In Drupal 6 the function 'path_to_theme is changed by design. Now it points to the path of de module were it is used.
That is the reason the mail.css can't be found.

The solution is to replace line 496 by:

$type = 'theme';
$name = variable_get('theme_default', NULL);
$path = drupal_get_path($type, $name);

$styles = $path .'/mail.css';

Anonymous’s picture

With thanks to globaldrifter / http://drupal.org/node/329710

mariuss’s picture

@Jaapx, how is this different from the original fix I suggested?

Also, AFAIK, you set the status to "patch..." only if you actually attach a patch.

Anonymous’s picture

@mariuss, I didn't realise I breach the rules of the house, I promise will study the 'Issue queue book' . Where could I have found your fix? I like use existing fixes more than debugging!

mariuss’s picture

@Jaapx, for my fix just look at the description of this issue.

jerdavis’s picture

Status: Needs review » Fixed

I've just committed a fix for this issue based on the suggestions above. I decided to use a version of the fix from #3, as the desirable behavior would be to get the default theme path. This would provide a consistent path, where using the $theme global could cause issues if the message was originating from a page within the admin area (the Simplenews form, for example) and an admin theme was being used.

The fix for this issue will be in the next development build for 6.x - please test and let me know if you run into any issues!

Jer Davis
Advantage Labs, Inc.

Status: Fixed » Closed (fixed)

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