It would be helpful for those of us that keep their styles in a different directory than the theme root if we could specify the directory that mail.css is located in.

Comments

ibes’s picture

Hi,

how should this be possible?
Define a directory and mimemail search for an "mail.css" or define a specific file like "sites/all/themes/mytheme/css/mymail.css"?

Actually mimemail checks the default theme for a mail.css in the theme root directory

file mimemail.admin.inc - line 11:

function mimemail_admin_settings() {
  // Check for the existence of a mail.css file in the default theme folder.
  $theme = variable_get('theme_default', NULL);
  $mailstyle = drupal_get_path('theme', $theme) . '/mail.css';
  // Disable site style sheets including option if found.
  if (is_file($mailstyle)) {
    variable_set('mimemail_sitestyle', 0);
    $disable_sitestyle = TRUE;
  }
  else {
    $disable_sitestyle = FALSE;
  }

and if this file is existing, take it as the style for the mail:
file mimemail.theme.inc - line 49

  $sitestyle = variable_get('mimemail_sitestyle', 1);
  $mailstyle = $themepath . '/mail.css';

  // Check for the existence of a mail.css file in the current theme folder.
  if (@file_exists($mailstyle)) {
    $styles = $mailstyle;
  }
  // If no mail.css was found and the site style sheets including is enabled,
  // gather all style sheets and embed a version of all style definitions.
  elseif ($sitestyle) {

So if there is another textfield in the admin page which defines an alternative location, that could be checked before ore after the module checks for the mail.css
If there is a file in that specific location, it will be chosen for the $mailstyle

What should be more important? "mail.css" in the default theme or a file in the specific place?
I would vote for the second one - because the admin has to manually define this.

And should one define a file or a directory? (if directory, the .css file has to have a exact name like "mail.css")

And I guess it would be great to validate, if the specific place is a directory/file.

ibes’s picture

Status: Active » Needs work
gnindl’s picture

Version: 7.x-1.x-dev » 6.x-1.0
Status: Needs work » Needs review
StatusFileSize
new1.1 KB

The attached patch searches all files called mail.css recursively in the theme folder. So I can just put the mail.css in the css subfolder.

sgabe’s picture

Title: Allow for definition of where mail.css is located » Scan recursively for mail.css
Status: Needs review » Fixed

Thanks gnindl, committed to both branches!

Status: Fixed » Closed (fixed)

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