Mailer layouts , how to link to a css file


#1

I can send html emails using the new layouts feature

using inline style, there is no problem to get a nice display…
but what if ?

i would like to link to a css file , … which king of link ? to
public/stylesheets/email.css

if there is any relative image in the css for a background url ?
like

#header {
background: #ffcc00 url(…/…/…/images/logo.png) no-repeat 2px;
}

thanks for you help ?


#2

On Thu, Jan 15, 2009 at 3:43 AM, Kad K.
removed_email_address@domain.invalid wrote:

i would like to link to a css file , … which king of link ? to
public/stylesheets/email.css

Nothing to do with RoR, but you need to provide absolute, complete
URLs, e.g. ‘http://example.com/stylesheets/email.css’.

if there is any relative image in the css for a background url ?

Same deal,

background: #ffcc00 url(http://example.com/images/logo.png) no-repeat 2px;

HTH,

Hassan S. ------------------------ removed_email_address@domain.invalid


#3

Hassan S. wrote:

On Thu, Jan 15, 2009 at 3:43 AM, Kad K.
removed_email_address@domain.invalid wrote:

i would like to link to a css file , … which king of link ? to
public/stylesheets/email.css

Nothing to do with RoR, but you need to provide absolute, complete
URLs, e.g. ‘http://example.com/stylesheets/email.css’.

if there is any relative image in the css for a background url ?

Same deal,

background: #ffcc00 url(http://example.com/images/logo.png) no-repeat 2px;

HTH,

Hassan S. ------------------------ removed_email_address@domain.invalid

Thanks a lot … I’ll stop my tests… (was trying various option)
;-)) !

btw: discovered a bug using multiparts with layout ( the plain text get
the html source code…) with a nice trick to be inserted in the
environment.rb … in case someone reads this post

module ActionMailer
class Base
private
def candidate_for_layout?(options)
(!options[:file] || options[:file].content_type != ‘text/plain’)
&& !@template.send(:_exempt_from_layout?, default_template_name)
end
end
end

thanks again !