warning when sending newsletter:

* warning: file_get_contents() [function.file-get-contents]: Filename cannot be empty in mimemail.module on line 398.

also described here:
http://drupal.org/node/513380

Comments

krabbe’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev

It's a 6.x-issue, no?

tecum’s picture

I am having this issue in 5.x-1.0.
In my module I am calling the mimemail(...) function to send an email with attachemts although I would not need html-/styled emails.
The emails always got sent but caused this error messsage in the watchdog.
I solved it by adding an empty mail.css in the themes folder of the admin theme (garland) (the mails got sent by clicking a button in the admin view).

argosmm’s picture

Thanks Silvan I have this problem 1 year and I don't use this module simplenews.

mo6’s picture

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

Indeed, adding an empy mail.css in the theme directory solved the problem for me too. Still, this error should be handled by the module.

benwei’s picture

I see this on 5.x-1.0 also. It looks like it's due to this code:

  if (!file_exists($styles)) {
    // embed a version of all style definitions
    $styles =preg_replace('|<style.*"'. base_path() .'([^"]*)".*|', '\1', drupal_get_css());
  }
  foreach (explode("\n", $styles) as $style) {
    $output .= file_get_contents($style);
  }

If the returned value from drupal_get_css() has a trailing newline, when we split by newline, we end up with a final empty filename.

I just wrapped the call to preg_replace() in a trim() to strip leading/trailing whitespace and all is good now.

freedayum’s picture

benwei, thanks,that seems to fix the empty-file issue.
Would anybody let me know when does a newsletter gets sent?, does it get sent when a newsletter is created and evertime when it's edited?.
I have the selected the 'Send newsletter' option ( under Default selection for sending newsletters:) , but I don't see any newsletters to the test email-ids I have set.

dex002’s picture

trim() worked for me too, nice fix - thanks

sgabe’s picture

Status: Active » Closed (won't fix)

Closing issue, Drupal 5 is no longer officially supported.