media=<print|screen|all> selector stripped from mime_mail embedded css
| Project: | Mime Mail |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
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.

#1
This 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.
#2
I 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.