When used in conjunction with Simplenews, images which are added to either simplenews-newsletter-body.tpl.php or simplenews-newsletter-footer.tpl.php are being embedded into the message with a src of cid:1be6693408de7c23aefde4a65ff51439@www.domain.com etc but these images are not being displayed or attached to the e-mail.

Strangely however, images which are added to the body of the content created in Simplenews are being displayed correctly using the full URL supplied. This used to work OK until I updated to the newest version of Mime Mail recently.


mindgame’s picture

Maybe this is related - but doesn't help much:

I found more info here and posted a "quick fix" (I had the same problem as described above):

webel’s picture

Am getting something very similar, however I can't find a pattern for which images work and which don't (and it is not size, and it is not image type).

webel’s picture

I tried applying mindgames' quick fix reported at http://drupal.org/node/436706#comment-1530848, which I repeat here to keep the thread clean:

Then I had a look here
at Commit #174768 where a patch was applied about "duplicate image items".

When I remove the three lines dealing with $filenames in function _mimemail_file() of mimemail.inc, i.e. I undo the patch
then the missing images appear again.

to this version:
/* $Id: mimemail.inc,v 2009/04/14 23:08:59 jerdavis Exp $ */

Now when I send the newsletter nothing arrives but the title !

So I applied the fix for mangling of HTML headers as reported here: http://drupal.org/node/438058, http://drupal.org/node/387462

//ORIG  $subject = mime_header_encode(drupal_html_to_text($subject));
  $subject = mime_header_encode($subject);

And still when I send the newsletter nothing arrives but the title !

So now I am rather frustrated. Could somebody please patch things up and provide a mimemail that neither mangles HTML titles nor makes any images disappear ?

webel’s picture

I checked out the latest from HEAD and now the newsletter arrives as text only, with long URLs for all links etc.

webel’s picture

Ok, after days (!!!) of trying different versions I have managed to send a clean newsletter, and I seem to have found the cause of my problems, although I don't understand what I have seen at all. I am working with:

/* $Id: mimemail.inc,v 1.40 2009/02/23 16:11:19 jerdavis Exp $ */

Firstly, the problem reported above at May 16, 2009 - 11:17 'now the newsletter arrives as text only' was a furphy, somehow when I installed a new version of Mimemail the newsletter option for HTML/'plain text' reset and so of course the Newsletter arrived in plain text.

I explored the problem with some images by starting a fresh newsletter. Because I am using Composite to manage my newsletter layout, I was able to build up the newsletter cell by cell to find which ones contained an image that provoked the problem. It seemed to be caused by images with names that had more than one period '.' character, like image.bw.png, which gave rise to the src attribute in the img tag taking the value Array(). The same occurred for images with underscore '_' and/or hiphen '-', so I renamed all of those images to only use alphabetical characters and to have a clear suffix like .png or .jpg or .gif.

Strangest of all, when an image was causing a problem, it also seemed to cause problems with other images that had otherwise arrived just fine when used alone !

One of the most annoying, frustrating, time-wasting, cryptic, and absolutely hair-greying bugs (dare I say "feature nuance") I have ever encountered in 30 years of programming. What a week. At least now I have a way of working and resuming progress towards delivering my newsletter to recipients, even if I am none the wiser.

I remain most grateful to the developers of Simplenews; please though look into this problem and solve it before anybody else suffers further hair loss.

webel’s picture

PS: The Composite newsletter can be viewed at http://www.webel.com.au/newsletter

webel’s picture

PPS: my problems had started with the following version:

mimemail.inc,v 2009/02/22 01:58:24 jerdavis

Which I had used without image problems (but indeed with title-problems, since they were treated as HTML and newlines inserted) for the following newsletter:


And because that newletter had used images and Composite layout and sent ok, I was all the more confused as to why my own newsletter would fail for some images only.

annsera’s picture

Webel, thanks for your work on this and putting together a nice issue report. It's going to help me send newsletters (if I can find a version of mimemail which doesn't break the mail functionality of my site completely).

webel’s picture

Latest update, I can now send a Composite newsletter ok to Thunderbird mail client, to Yahoo!Mail, and to Hotmail, but for some reason some (only) images are not visible on GMail, (Google Mail), and I can't see how to get at the page or frame source on gmail, so I'm none the wiser. May or may not be a Mimemail issue.

fred0’s picture

Hello all,

I found this thread because I was having a similar problem using Notifications & Messaging. Images would embed when the number of subscribers was limited to single digits (never found the exact limit) but would fail when sending to my entire ~7000 user base. After much tweaking of settings for both php limits and in the process limits of Notifications & Messaging, I finally found the answer while considering using PHPMailer instead (which I'm going to do any as the output is cleaner).

What MimeMail really doesn't seem to like is relative paths. By adding Pathologic to the input filter used by MimeMail, all the images appeared!

Hope that helps someone!

Oh, also, if you're using a wysiwyg editor that outputs links with a leading / (ie - /sites/default/files/image.jpg), you need to config Pathologic to recognize / as a local path as described here: http://drupal.org/node/298558#comment-986128

BMorse’s picture

Are you saying that installing Pathlogic solved the problem of images not showing up when when you send to hundreds+ subscribers? I don't see how the two are related. What would happen if in your WYSIWYG you just manually entered the full path/url to the image? Would the image still fail when sending to lots of addresses?

I am trying to solve the mystery of why the images show up in the test email messages whether the full path is included or not, but when sent to the full list the images are not included.

fred0’s picture

It seemed that with relative URLs, the img src links looked like this:

<img src="cid:05513085cc873adef711fa591faa4d9f@domain.com" />

After adding Pathologic, they appear as

<img src="http://domain.com/sites/default/files/file.png" />

I hadn't tried authoring a node with an image defined as an explicit URL and won't have the chance as I have now ditched MimeMail in favor of PHPMailer (which also had missing images until I installed Pathologic).

BMorse’s picture

Can PHPMailer be used in place of Mime Mail when using Simplenews? The Simplenews page doens't mention PHPMailer.

Whoops. Never mind. I see PHPMailer can be used in conjunction with Mime Mail.

fred0’s picture

I don't think so. I was using the Notifications and Messaging modules. The messaging framework has several options, Mime Mail and PHPMailer among them.

nvisioncurtis’s picture

My images are arriving in my mail with relative links and so don't show as broken links...

I can't determine if this is a glitch or setting issue? Any ideas?

I'm using Drupal 6 / latest simple news/ HTML mail module / SImple news patch for HTML MAIL module

nvisioncurtis’s picture

This looks like it will fix my issue of relative images links in Emails...

Okay so two things helped me with my issue of broken email images in newsletter emails.

I chose to use the module absolute src module drupal.org/project/abssrc but also I had to make sure imagebrowser setting let apache serve the images and not Drupal.

I chose this over pathlogic module becuase its still in beta.

Perhaps this will help some one.

NicP’s picture

Ok I had the problem of only getting the first email with the images. With mimemail it tries to embed all images. That is they are send with the email as multi part elements. I think I prefer the images located on the website but I'm not fighting the way it does it.

It is clear that the patch of 23 Feb was the cause of the problem, it was clearly trying to stop images that appear more than once in the email body from being attached multiple times, a reasonable aim.

The issue is the two static arrays, you can see $files gets reset when the function is called without parameters but $filenames does not. By adding $filenames = array(); directly after $files = array(); (line 149) it seems to clear the problem.

When using the cron job the first email in its series will get the images the rest not that is why some get the images others not.

I have been using Drupal for a week now and it is the first real problem I've run into. I'm sure with Joomla I had problems with the first add on, ie day one.

Still mimemail is still an alpha release. Disappointing that it has not been updated since February.

acb’s picture

I too see NicP's problem. Trying to fix it. Only workaround right now is to use fully-encoded URLs in the html source of the email:

<img src="http://example.com/blah.jpg" />

This isn't really a fix at all. just avoids the problem. Anyone figure this one out?

imclean’s picture

NicP gave you the solution.

The issue is the two static arrays, you can see $files gets reset when the function is called without parameters but $filenames does not. By adding $filenames = array(); directly after $files = array(); (line 149) it seems to clear the problem.

The file he's referring to is mimemail.inc.

See also post #5: #358439: Images are only in the first message

ikeigenwijs’s picture

if (!$name) $name = substr($file, strrpos($file, '/') + 1);

$new_file = array(
'name' => $name,
'file' => $file,
'Content-ID' => $content_id,
'Content-Disposition' => $disposition,
$new_file['Content-Type'] = file_get_mimetype($file);

$files[] = $new_file;
$filenames[$file] = $content_id;

return 'cid:'. $content_id;

$ret = $files;
$files = array();
$filenames = array();
return $ret;

here at the bottum, is this the right location, because you also have
static $files = array(); @116
static $filenames = array();

both sugested modifications have not the desired effect.

sgabe’s picture

Status: Active » Closed (duplicate)

IMHO this one too is a duplicate of #358439: Images are only in the first message. Please try the latest HEAD, the image embedding issue should be solved by now except this #114312: Embedded images when Drupal is in a subdirectory.

webel’s picture

Status: Closed (duplicate) » Active

I am again having trouble with some images not attached to (test) newsletters.

I do not agree that this is a duplicate of #358439: Images are only in the first message.

The newsletter is fine online:


Three of the images attach fine:


The others do not:




Admittedly the last image has a complicated long name, and the one before it is is in a subdirectory of files (files/media/newsletter), but the one nlDarrenKellyIMG1824cropx100close.jpg is in the same directory as the other images. I can't see a pattern to this.

sgabe’s picture

@webel: Please, attach the message source.

webel’s picture

Status: Active » Closed (duplicate)

Well I seem to have got it to work ok on every mail client I've tested except Gmail.

I had to change the name of one image to use no underscores and no spaces:


The 2 other trouble images "just worked" when I removed and reuploaded them.

I am none the wiser for my trouble. I've restored 'duplicate' status, however I'm not convinced there aren't at least 2 separate issues.

mhr’s picture

I just had my customer send out two newsletters to a few hundred people without images after testing it two times on a test newsletter with 4 people in it.

This is a major problem, i don't know what to do - actually loosing money through this shit :/.

cybernomad’s picture

Renaming the images worked for me too, no underscores or spaces i am using simplenews 1.3

3rdvalve’s picture

We ran into the same issue - images with underscores were not being handled correctly. Using filenames with no underscores fixed the issue in some cases but not with aol or gmail.

Sending a test newsletter works fine - the images appear. Sending out the newsletter to the subscriber list breaks the images.

We're using Simplenews 6.x-1.3.

We solved the issue by upgrading to the Mime Mail module version 6.x-1.0-alpha6.

So far so good.