I've been trying to send html with css emails with ActionMailer, the
html part goes perfect, but the css doesn't seem to work.
I have tried using
<link href="http://url/stylesheets/layout.css" rel="stylesheet"
type="text/css" />
and also embeding it in the html, like this:
<style type="text/css">
body {
....
}
</style>
Most email clients block links to external stylesheets. So your
embedding version should work. I use this all the time so I'm not
certain where you're getting blocked. Have you tested it across
multiple email clients? What does the raw email body look like? As you
expect or is the css getting pared out?
Iâm sending the email to my gmail account (this one) and it doesnât render the css.
Now that you mention it Iâm trying to watch it through thunderbird (using POP in my gmail account) and the embeded version works nicely. Any guess why gmail doesnt show the mail correctly?
What does the raw email body look like? As you
expect or is the css getting pared out?
Yes, there are no characters scaped or something strange in the mail, at least, nothing that i noticed.
Here is a paste of the âShow Originalâ from gmail:
I've been trying to send html with css emails with ActionMailer, the
html part goes perfect, but the css doesn't seem to work.
I have tried using
<link href="http://url/stylesheets/layout.css" rel="stylesheet"
/
and also embeding it in the html,
/
but none of those ways seems to work
In my experience, inline CSS gives the best results across a variety
of email clients.
If one has to have HMTL/CSS emails, go "1996" HTML. Use tables for
layout. That sort of thing.
Now I haven't used this service but I saw it a while ago.
http://www.mailchimp.com/add-ons/inboxinspector/
"MailChimp Inbox Inspector - Check your email marketing campaigns with
one easy click"
It renders your email in different clients so you can see how they
look.
I'm facing the same problem: sending an HTML mail formatted with an
internal stylesheet be will displayed unformatted in some mail clients,
i.e. GMail:
<style type="text/css">
<!--
h1{color: red;}
-->
<h1>Hello</h1>
Instead, you have to use inline style (inside an HTML element):
<h1 style="color: red;">Hello</h1>
I have a scenario where in my system is generating the mail and it is
being sent via my gmail acc and it has an attachment as well with
predefined text and all. But when the same mail is sent from the
clients system, then in my attachment the disclaimer of the client
company is coming in.
Why is this happening. My emails should have the settings of my
account but why does the client settings chip in even when emails are
being sent out using my account.