I'm not sure exactly what the problem is, but I'm using newsletter to send out html emails.

1) I start with no mail.css in my theme directory
2) I send out a newsletter
3) I get the html email and it looks one way
4) I copy style.css to mail.css in my theme directory (they are identical)
5) I send out a newsletter
6) I get the html email and it looks different

In my case, it's the image alignments that are different, but I'm sure there are other possible problems.

Shouldn't the mail look identical if I copy style.css to mail.css ?

(Found this by trying to pare down mail.css, getting an unexpected output, and backtracking.)

Comments

tunesmith’s picture

sorry, I'm braindead here - forgot that mimemail would also import all the other legion of stylesheets... must be missing something from one of those.

FreeFox’s picture

Don't know if this can help but here my 2 cents.

I use the mail.css too but only have a few rules in it. My guess is that if you copy the styles.css you just copy too much and mimemail is not a web-server. I recommend to only put styles in mail.css that you really need. Here is my mail.css.

/* Set background to white else the background color of the theme is used */
/* Set a maximum width for the body tag to show not full width is most mail clients */
body {
    background: #ffffff;
    max-width: 555px;
}
/* To hide the H2 tag from the top of the mail */
h2 {
    visibility: hidden;
    height: 0px;
}
/* Max width for tables to not stretch to full width in mail clients */
table {
    max-width: 555px;
}
/* Mod to show mail correct in Kerio web-mail */
#main {
    left:50px;
    position:relative;
    top:0px;
    width:555px;
}

Hope this helps
Jan

allie micka’s picture

Status: Active » Closed (fixed)

All of your styles are being imported, but not necessarily all of your HTML.

For example, you might have a background color set for the body, and a content-containing DIV that has a white background. Inside of that, your HTML renders as expected.

Now, by default, a mimemail message will use all of your styles, so you'll get that colored background. But if that white-backgrounded DIV is not included in your message.

There's not much I can do about this programmatically. The solution is to tweak mail.css accordingly (which will also optimize your message size)

Alternatively, you can style #mimemail-body so that it has a correctly-colored background.

dtabach’s picture

I'm glad to know that by creating a mail.css we can have some control over the way messages look.
But, I don't know why, the body {} is not read here. I know mail.css is being interpreted, because other styles are considered.

My theme (Abac Dark) has light-grey text over a black background, and now my mails have black text over white background, despite having set body to green text and red background (just for testing). So it means the theme's style.css is also being ignored. It's acting as if there was no body declaration in mail.css, and default values are used instead.

Why?

FreeFox’s picture

Maybe it's theme dependent or you have a typo or something else that goes wrong. I used it yesterday for a new site and ... it worked for me. Above you can see my mail.css. I changed the background color and the mails were sent in that color.

In Admin - Site configuration - Mail I have enabled "Use mime mail for all messages". Maybe this helps.

dtabach’s picture

Found the problem. DreamWeaver, which I used to create my mail.css, adds a @charset "UTF-8"; at the first line of the file. I thought it wouldn't hurt if I left that line unchanged. But I was wrong. When I removed it, the body started working.

Thanks for the help.

petr illek’s picture

Even four years later this thread helped me. :)
The @charset UTF-8 was my problem too.