In a drupal 6.10 site with Foliage as the default theme, it has been observed that emails send by Simple News in html and Mime Mail where completly black, instead of the the expected behavior: using the same color as the web site, which are provided by css.
After a troubleshouting described in the following link, it has been suspected that Mime Mail takes into account a file from Foliage named print.css. This files seems to be used on request by Iceweasel to produce b/w printings.
http://drupal.org/node/436706#comment-1514386
People sending emails complain that numerous recipients will never click on a black link which is event not underlined. Those link to the sender web site allow to send shorter emails which are easier to read and more apreciated from recipients.
As they could also be a problem in Foliage theme, the probleme will also be reported there.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | mimemail.443964_05.patch | 1.09 KB | sgabe |
| #7 | mimemail.443964_04.patch | 1 KB | sgabe |
| #6 | mimemail.443964_03.patch | 1.25 KB | sgabe |
| #5 | mimemail.443964_02.patch | 938 bytes | sgabe |
| #3 | mimemail.443964_01.patch | 938 bytes | sgabe |
Comments
Comment #1
jean-bernard.addor commentedThis comes from Mime Mail using the css print mode of the page, which may be producing b/w results. The idea is to let some color pass to that css print mode.
This issue is also reported in Foliage theme:
#443970: Mime Mail and print.css compatibility issue
A workaround is proposed.
Comment #2
pillarsdotnet commentedI have completely different symptoms which stem from the same problem.
In the
mimemail.modulefile, thetemplate_preprocess_mimemail_message()function adds style information to the email by taking the output ofdrupal_get_css()and concatenating the contents of all the linked stylesheets within a single<style>...</style>tag.Unfortunately, in doing so, mimemail is stripping the "media=" selector from each link, so that styles intended for printing are mixed with styles intended for screen display.
In my case, this resulted in my print.css stylesheet, which hides selected portions of the page for printing, also hiding certain portions of the Yahoo webmail API when their customers view my messages.
The fix is to replace each link by an embedded stylesheet, one-by-one, while retaining the "media=" selector.
I am attaching three patches, one to fix the css errors, one to fix various E_ALL warnings, and one to fix a mail_alter bug reported in #448996: Wrong implementation of hook_mail_alter().
I have also corrected some unrelated problems in the original code:
file_exists($styles)is made before the$stylesvariable is defined./usr/sbin/sendmailchokes whenever a single line exceeds 5000 characters.Comment #3
sgabe commentedI think it's better (less drastic modification at least) if we just remove the lines which have print media type.
Comment #4
gjvoosten commentedI agree with sgabe in #3, less of an impact to just skip the print styles.
Please note: in sgabe's patch, the line reading
+ $styles = preg_replace($pattern, $replaces, drupal_get_css());
should be
+ $styles = preg_replace($patterns, $replaces, drupal_get_css());
($patterns instead of $pattern).
[Additional note: I see sgabe has corrected it in the patch on http://drupal.org/node/743150 ]
Comment #5
sgabe commented@gjvoosten: Yeah, I forgot to attach the right patch. Thanks for noticing.
Comment #6
sgabe commentedI am attaching a patch with another approach, posted by AlexisWilke in #870568: CSS concatenation problems & solution.
Comment #7
sgabe commentedPlease ignore the previous patch...
Comment #8
sgabe commentedI think we should use CSS files with theme type only.
Comment #9
aron novakThis patch works fine, even if it does not apply cleanly anymore.
I'm ready to make it clean again for both 6.x and 7.x, it's quite a major thing for everyone who has fine-grained print.css, but does not need a completely different mail.css
Comment #10
sgabe commentedChanging version.
Comment #11
sgabe commentedCommitted to both branches.