Hello! 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> but none of those ways seems to work :''( Any ideas? I''m using Rails 2.0.2 Thx in advance --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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? On Jan 20, 2008, at 12:45 PM, Alejandro Riera wrote:> > Hello! > > 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> > > but none of those ways seems to work :''( > > Any ideas? > > I''m using Rails 2.0.2 > > Thx in advance > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> > Have you tested it across multiple email clients?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: -------------------- Delivered-To: ariera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Received: by 10.141.197.3 with SMTP id z3cs234339rvp; Sun, 20 Jan 2008 12:59:51 -0800 (PST) Received: by 10.114.167.2 with SMTP id p2mr3929238wae.78.1200862791200; Sun, 20 Jan 2008 12:59:51 -0800 (PST) Return-Path: <ariera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Received: from pants.dreamhost.com (pants.dreamhost.com [ 66.33.216.244]) by mx.google.com with ESMTP id k39si13460028wah.4.2008.01.20.12.59.50; Sun, 20 Jan 2008 12:59:51 -0800 (PST) Received-SPF: neutral (google.com: 66.33.216.244 is neither permitted nor denied by domain of ariera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org) client-ip=66.33.216.244; Authentication-Results: mx.google.com; spf=neutral (google.com: 66.33.216.244 is neither permitted nor denied by domain of ariera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org) smtp.mail=ariera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Received: from smarty.dreamhost.com (smarty.dreamhost.com [ 208.113.175.8]) by pants.dreamhost.com (Postfix) with ESMTP id A3D8314C009 for <ariera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>; Sun, 20 Jan 2008 12:59:50 -0800 (PST) Received: from oj.dreamhost.com (oj.dreamhost.com [208.97.183.24]) by smarty.dreamhost.com (Postfix) with ESMTP id 436CFEE298 for <ariera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>; Sun, 20 Jan 2008 12:59:49 -0800 (PST) Received: from localhost.localdomain (localhost [127.0.0.1]) by oj.dreamhost.com (Postfix) with ESMTP id 3F8BAD070E for <ariera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>; Sun, 20 Jan 2008 12:59:49 -0800 (PST) Date: Sun, 20 Jan 2008 12:59:49 -0800 From: ariera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org To: ariera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Message-Id: <4793b64538837_6bbe20177bac151-ZeggDWxp9DI@public.gmane.org> Subject: =?utf-8?Q?=5bVDC_newsletter_n=c2=ba=32=35=5d_Lorem_Ipsum? Mime-Version: 1.0 Content-Type: text/html; charset=utf-8 <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Lorem Ipsum</title> <style type="text/css"> * { padding: 0; margin: 0; } body { font-family: Arial, Helvetica, sans-serif; font-size: 14px; } #wrapper { margin: 0 auto; width: 800px; border: solid; border-width: 1px; border-color: #306; } #wrapper a{text-decoration:underline; color: #330066; font-weight: bold;} #wrapper a:hover{text-decoration:none; color: #cc00cc;} #wrapper a:visited{color: #996699;} #cabecera { width: 800px; } #navegacion { width: 780px; color: #ccf; padding: 10px; margin: 0px; background: #306; /* border: solid; border-width: 1px; border-color: black; */ } #boletin-info .fecha {text-align:left; float:left;} #boletin-info .numero { text-align:right; text-decoration: underline;} #central { /*background: url(central-1-2-col.gif);*/ overflow: auto; /* Paul O Brien Fix for IE www.pmob.co.uk */ width: 760px; padding: 10px 20px 10px 20px; /* border: solid; border-width: 1px; */ } #enlaces {text-align:center; font-size: 16px; padding: 20px 0px 20px 0px;} #enlaces li{list-style-type:none;} #pie { width: 800px; color: #306; background: #fff; border: solid; border-width: 2px 0px 0px 0px; overflow: auto; /* linea magica, sino firefox hace cosas raras */ font-size: 12px; } #pie li{list-style-type:none;} .pie-izq{ color:black; width: 390px; padding:5px; float:left; display: inline; /* linea magica, sino firefox hace cosas raras */ text-align: right; } .pie-dch{ width: 390px; padding:5px; float:right; display: inline; /* linea magica, sino firefox hace cosas raras */ text-align: left; } #disclaimer{ padding: 10px 80px 10px 80px; font-size: 10px; background: #330066; color: #ccf; text-align: center; } #disclaimer a{ color: #969; font-weight: bold;} #disclaimer a:visited{ color: #ccc; } #disclaimer a:hover{ color: #ccf; text-decoration: none;} </style> </head> <body> <!-- Begin Wrapper --> <div id="wrapper"> <!-- Begin cabecera --> <div id="cabecera"> <img alt="Facultad de Informatica - Newsletter" src=" http://boletin.yoteinvoco.com/images/cabecera.png" /> </div> <!-- End cabecera --> <!-- Begin navegacion --> <div id="navegacion"> <span id="boletin-info"> <p class="fecha">5/1/2008</p> <p class="numero">boletin nº 25</p> </span> </div> <!-- End navegacion --> <div id="central"> <h2>Lorem Ipsum</h2> <p class="cuerpo"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas est dui, tempus quis, ullamcorper non, dictum vel, ligula. Quisque iaculis leo eget turpis. In a elit id elit semper fermentum. Mauris tincidunt odio id diam. Nunc fringilla eleifend urna. Donec fermentum scelerisque magna. Sed rhoncus. Nullam accumsan elementum ipsum. Maecenas ac purus. Nam gravida venenatis sem. <br/> <br/>Nulla facilisi. Vestibulum pretium lectus semper odio hendrerit pharetra. Cras eget sapien. Aenean pretium eros id justo. Proin pellentesque dolor. Vivamus enim arcu, varius vel, elementum ac, tempor et, pede. Donec ac libero. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer nulla ante, consequat quis, dictum at, faucibus eu, metus. Cras aliquam. Integer consequat hendrerit odio. <br/> <br/>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec diam orci, tristique at, bibendum accumsan, egestas eu, diam. Nullam elementum nisl ac urna. Etiam gravida. Phasellus euismod est eu ante. Suspendisse potenti. Nulla auctor nisi. Duis ut ipsum ut lorem consectetuer accumsan. Donec posuere dui eu massa. In condimentum ultrices nisi. Sed felis justo, adipiscing eu, ultrices eget, porttitor et, ante. Maecenas semper. Suspendisse ornare felis eget est. Aliquam eu ligula quis mi tincidunt scelerisque. Sed viverra. Nam id orci. <br/> <br/>Suspendisse et libero. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Morbi augue metus, interdum id, egestas sed, congue a, nulla. Fusce in enim eget diam pretium vestibulum. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Pellentesque a risus a lectus interdum molestie. Nulla facilisi. Vivamus lectus tellus, cursus at, faucibus vel, ornare nec, purus. Vivamus non pede. Donec id augue. Nam sit amet augue. Nunc et metus sit amet nisl consequat sagittis. Sed venenatis nibh quis eros. Aenean viverra enim vel felis. Mauris mauris lorem, sodales ut, pharetra in, sollicitudin quis, tortor. <br/> <br/> </p> <ul id="enlaces"> </ul> </div> <!-- End central --> <div id="pie"> <div class="pie-izq"> <ul> <li>Vicedecanato de Calidad</li> <li>Facultad de Informática</li> <li>U.P.M.</li> </ul> </div> <div class="pie-dch"> <ul> <li><a href="http://www.fi.upm.es/?pagina=441"> http://www.fi.upm.es/?pagina=441</a></li> <li><a href="http://www.fi.upm.es">http://www.fi.upm.es </a></li> <li><a href="http://www.upm.es">http://www.upm.es </a></li> </ul> </div> </div> <div id="disclaimer"> Vd. ha recibido este correo de forma automatica porque así lo ha solicitado si desea darse de baja del servicio y parar de recibir correos pinche <a href="asdsadsasddsads">aqui</a> y siga los pasos indicados. </div> <!-- End pie --> </div> <!-- End Wrapper --> </body> </html> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jan 20, 2008 12:45 PM, Alejandro Riera <ariera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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. FWIW, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Gmail isn''t going to let you do something dangerous like that, lol. They don''t even let you see external images without saying yes first ^_^ On Jan 20, 3:21 pm, "Hassan Schroeder" <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jan 20, 2008 12:45 PM, Alejandro Riera <ari...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > 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. > > FWIW, > -- > Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jan 20, 2008 1:34 PM, kopf1988 <kopf1988-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Gmail isn''t going to let you do something dangerous like that, lol.Are you suggesting that "inline CSS" is dangerous?? How so? In any case, I can assure you that the HTML emails I do for clients render just fine in Gmail :-)> > In my experience, inline CSS gives the best results across a variety > > of email clients.-- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. HTH John On Jan 20, 5:10 pm, "Hassan Schroeder" <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jan 20, 2008 1:34 PM, kopf1988 <kopf1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Gmail isn''t going to let you do something dangerous like that, lol. > > Are you suggesting that "inline CSS" is dangerous?? How so? > > In any case, I can assure you that the HTML emails I do for clients > render just fine in Gmail :-) > > > > In my experience, inline CSS gives the best results across a variety > > > of email clients. > > -- > Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
neharohan.chopra-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Mar-03 17:21 UTC
Re: css and ActionMailer
Hi, 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. Any thoughts on this. Neha On Feb 19, 11:12 am, Patrick Baselier <rails-mailing-l...@andreas- s.net> wrote:> 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> > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---