Closed (fixed)
Project:
Mime Mail
Version:
7.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
11 Jan 2007 at 15:48 UTC
Updated:
16 Sep 2012 at 15:24 UTC
Jump to comment: Most recent file
Comments
Comment #1
allie mickaYou mean having CSS images included in the message itself?
Great idea! I've always wanted that too. Please feel welcome to submit a patch :)
Comment #2
allie mickaUpdating version and making the title more informative
Comment #3
matthewbot commentedThis is a lot harder than it looks... url()s in CSS are relative to the CSS file, not the site. We currently put the CSS into an inline
<style>as part of theme_mimemail_message(), throwing away any path information. I think we could simplify things dramatically by generating absolute URL<link>tags and not attaching or including CSS in the message at all.I think this logic could even be applied to all inline attachments. Whats the reasoning behind attaching things at all? Not meaning to be critical, just curious. It adds a lot of complexity.
Right now, from what I can tell, the code doesn't really handle it correctly either. If you pass an image tag
<img src="/test.gif" />it would appear to simply pass "test.gif" to _mimemail_file_attach(), which just looks for it in the mimemail module directory. I guess this is a separate issue, but we could fix both and simplify the code considerably by just generating absolute URLs.Comment #4
allie mickaThere are lots of valid reasons for delivering the node's content as a whole. Many mail readers can't/won't include remotely-hosted images ( they're web bugs! ), or perhaps the user is offline on otherwise unable to access the images. Or perhaps you don't want to account for making sure the original node/file hasn't been removed.
When I originally wrote send/mimemail, the design goals were to ensure that product sales lists rendered beautifully, independently of the MUA's decision to (not) show images. And now, mimemail/mlm is being used for online discussion participation where some of the users are in 3rd world countries, and aren't guaranteed an always-on connection.
Back on-topic, I agree with your CSS assessment for inline attachments. And that it's relatively non-trivial. Which is why I only gave it a +1 :)
Comment #5
matthewbot commentedAnother issue with this is that when we do pull in all of the theme css we'll also pull in most if not all of the theme's images too, making the emails massive. So, doing this will basically necessitate the user providing a custom mail.css or message theme, because otherwise we'll basically be shipping major portions of the site's theme out with every email. The solution would be to either provide a default mail.css, or specifically to not load images from the theme css. I think providing a default mail.css might be a good idea, since people have had issues with themes whose CSS doesn't play well with the email. But again, if there is an important reason behind using the theme's CSS, perhaps we can allow the user to pick?
Comment #6
allie mickaAgreed.
The include-the-kitchen-sink approach is fairly ham-handed and heavy, but it works more often than it doesn't. Most folks I've worked with who deploy mimemail really appreciate that it looks "almost" like their site and it only takes a small amount of tweaking to make things right.
I don't want to give this up, which is what would happen if we shipped a mail.css file that didn't match any theme. This is also a problem when other modules include CSS files to format fields, etc. in a way we don't account for.
It would make me happy if we could extend those benefits by making emails look as close to web output as possible with zero effort, but it would also make me happy to slim down the messages significantly. And I'm a system administrator by trade, so I'm not just saying that.
Maybe we can compromise and set CSS images to be fully-qualified instead of baking them in. But that seems inconsistent with other stuff we've done.
I dunno. I want this feature, but I don't want to tack on an extra 100kb to each message for it.
Comment #7
As If commentedI don't really understand why CSS is part of the discussion. But maybe that's because I use embedded graphics in email only sparingly, not trying to literally recreate a website experience. But anyway, the proper way to do this (and solve the disconnected reader problem while you're at it), is to base64-encode the image, include it as a MIME part inside a "multipart/related" part, and give it a unique string called a cid. Then you can use the cid instead of a URL in your message body, like this:
<img src='cid:12345678900AB'>You can find all the dirty details in the RFCs...http://www.faqs.org/rfcs/rfc1341.html
http://www.faqs.org/rfcs/rfc1521.html
http://www.faqs.org/rfcs/rfc2046.html
Comment #8
allie mickaThanks As If!
Mime mail is already doing what you describe for images that are embedded in your message. Per the issue title, we're also considering ways of embedding css images (e.g. background images) into the message as well.
Because the theme's CSS is already being included, this is a natural extension. And it would alleviate certain issues that crop up (e.g. we'll have a black background color but a light-colored background image, which gets lost in the translation)
If you re-read the other posts in this topic, you'll find we're not totally sure this is even a good idea, even though it's a good idea ;)
Comment #9
neopulse commentedI try to patch the mimemail module to allow this for 4 days, then I
I have read about the css_emimage module, http://drupal.org/project/css_emimage, i try another day to make compatible with the mimemail and fail, I affray I not longer go with this, I'm not good enough, now I'm convince.
If any of you has a solution please let me know
Comment #10
sgabe commented@neopulse: Here is my patch against current HEAD. Note that there is a lot to do before we can implement this in the right way.
Usage:
Example directory tree:
So in your mail.css:
Comment #11
neopulse commentedSorry, but doesn´t work for my. I even try a new installation, with garland theme, and nothing. Please, check the patch. The property background-image appear with no argument, see
The rest was omitted by me
Comment #12
sgabe commentedWhat kind of path did you use for the image?
Comment #13
neopulse commentedI use the path you recommend, base path in the default theme folder.
I try again in a fresh installation, and appear another issue, it include the image but not show in the mail.
In the next example i create a div with background image for comparison propose I insert another div with the same image.
Node code to send as mail
The CSS in the mail.css code as follow
I put the image aaa.jpg inside the image folder on the default theme.
The result, the first (background image) is inside the mail but not show and the second is corrected show.
Here the mail
As you see the background image is in the mail, but I can see it, the code of that image is just like the second one because there are the same image, they are just in different path, and the first is as CCS background and the second as an image, May be all of this can help you to localize my issue.
Comment #14
sgabe commentedNote that data URI scheme is not supported by some applications, what are you using? Please send me a test message to my address.
Comment #15
neopulse commentedI send you the message, with the newletter. Anwser me if you can, please.
Comment #16
sgabe commentedWhat application are you using? I think the problem is that encoded data must not contain newlines, but your application insert newlines. Using this patch I can send a message whit your image "attached" to it. Please try with different applications, I am using Thunderbird. I am sending you a test message which is correct on my PC.
Comment #17
neopulse commentedI use Mozilla Thunderbid version 2.0.0.17 (20080914). And don`t support (at least this version) that encode. But my main problem is gmail, yahoo and another web messengers, they don`t understand the encode, and i need users that are going to use theses email clients.
I have made my mail, without background images, i just put the images (there are just a couple) in tables cells, then put the text that have to be over the image inside another HTML labels and gave they a negative margin attributes, example
And the css
Every seems to be OK in Mozilla Firefox, Iexplore 7 and 8, even in my Mozilla Thunderbid email client, but Gmail and yahoo not apply the property margin-top: -15px; and put the text after the image.
That why I need the module encode background images, just for the webmails.
Its any way to encode the background images just like the embedded images??
Excuse my English please
Comment #18
sgabe commentedGMail does not support background-image, margin and a lot of other CSS properties at all. See the e-mail standards project for more information. This will work only if the application supports the background-image property and data URI schemes. Maybe you can find some workaround to create a layout which will work in one application, but in another it will be a nightmare. There is no e-mail application independent final solution.
Comment #19
sgabe commentedI guess the world is just not ready for this feature yet.
Comment #20
gagarine commentedI think a small line to explain the limitation and a link to http://www.email-standards.org/ on the front page of this project will help.
Comment #21
sgabe commentedAdded a note about this to the project page.